This repository has been archived by the owner on Dec 21, 2023. It is now read-only.
forked from remix-run/remix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(@remix-run/dev): add
resolveExtensions
and resolveAliases
co…
…nfigs This commit adds two new config options — `resolveExtensions` and `resolveAliases` — that together enable a user to configure their remix app to be able to utilize packages build with react-native-web (RNW). The config options are required due to two quirks of RNW: 1. RNW expects implicit file extension resolution to prioritize files ending with `.web.<ext>` over files ending with just `.<ext>` 2. Most packages that utilize RNW expect the bundler to alias imports of `react-native` to `react-native-web` when the package is being used in a web context. The `resolveExtensions` config option addresses the first quirk by passing the config value through to esbuild, and the `resolveAliases` option addresses the second by passing the value to the newly-added esbuild-plugin-alias plugin, and can be used thusly: /** @type {import('@remix-run/dev').AppConfig} */ module.exports = { /* ... */ resolveExtensions: ['.tsx', '.ts', '.jsx', '.js', '.css', '.json'] .map(ext => [`.web${ext}`, ext]).flat(), resolveAliases: { 'react-native': require.resolve('react-native-web'), }, }
- Loading branch information
Mikey Lemmon
committed
Sep 29, 2022
1 parent
e4fc0a5
commit b0e79b9
Showing
4 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5830,6 +5830,11 @@ [email protected]: | |
resolved "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.51.tgz#4adba0b7ea7eb1428bb00d8e94c199a949b130e8" | ||
integrity sha512-7R1/p39M+LSVQVgDVlcY1KKm6kFKjERSX1lipMG51NPcspJD1tmiZSmmBXoY5jhHIu6JL1QkFDTx94gMYK6vfA== | ||
|
||
esbuild-plugin-alias@^0.2.1: | ||
version "0.2.1" | ||
resolved "https://registry.yarnpkg.com/esbuild-plugin-alias/-/esbuild-plugin-alias-0.2.1.tgz#45a86cb941e20e7c2bc68a2bea53562172494fcb" | ||
integrity sha512-jyfL/pwPqaFXyKnj8lP8iLk6Z0m099uXR45aSN8Av1XD4vhvQutxxPzgA2bTcAwQpa1zCXDcWOlhFgyP3GKqhQ== | ||
|
||
esbuild-register@^3.3.2: | ||
version "3.3.2" | ||
resolved "https://registry.npmjs.org/esbuild-register/-/esbuild-register-3.3.2.tgz" | ||
|