-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ESM support for generated project (#583)
This adds ESM support to the generated project. To do this: - Use `.cjs` and `.mjs` file extensions for the generated files - Add file extensions to imports in the compiled code - Add the `exports` field in `package.json` - Update the `moduleResolution` config to `Bundler` in `tsconfig.json` In addition: - Enable the new JSX runtime option for React - Recommend removing the `react-native` field from `package.json` This is a breaking change for library authors. After upgrading, it's necessary to update the configuration by running the following command: ```sh yarn bob init ``` Alternatively, they can follow the [manual configuration guide](https://callstack.github.io/react-native-builder-bob/build#manual-configuration). In addition, typescript consumers would need to change the following fields in `tsconfig.json`: ```json "jsx": "react-jsx", "moduleResolution": "Bundler", ``` If using ESLint, it may also be necessary to disable the "react/react-in-jsx-scope" rule: ```json "react/react-in-jsx-scope": "off" ```
- Loading branch information
Showing
13 changed files
with
244 additions
and
128 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
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
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 |
---|---|---|
|
@@ -36,6 +36,5 @@ export default async function build({ | |
exclude, | ||
modules: 'commonjs', | ||
report, | ||
field: 'main', | ||
}); | ||
} |
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 |
---|---|---|
|
@@ -36,6 +36,5 @@ export default async function build({ | |
exclude, | ||
modules: false, | ||
report, | ||
field: 'module', | ||
}); | ||
} |
Oops, something went wrong.