Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading typescript-config module version to esnext #48230

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mateoguzmana
Copy link
Contributor

Summary:

Fixes #45810

Upgrading typescript-config module version from es2015 to esnext, in order to support dynamic imports.

Changelog:

[GENERAL] [CHANGED] - Upgrading typescript-config module version to esnext

Test Plan:

Create a new React Native project:

npx @react-native-community/cli@latest init AwesomeProject

Copy the changes in the reproducer from the linked issue and add a lazy import:

const LazyAssetExample = React.lazy(() => import('./components/AssetExample'));

See the error when running yarn tsc:

image

To fix the error, apply the following patch:

diff --git a/node_modules/@react-native/typescript-config/tsconfig.json b/node_modules/@react-native/typescript-config/tsconfig.json
index d5e1bce..51f54c1 100644
--- a/node_modules/@react-native/typescript-config/tsconfig.json
+++ b/node_modules/@react-native/typescript-config/tsconfig.json
@@ -3,7 +3,7 @@
     "display": "React Native",
     "compilerOptions": {
       "target": "esnext",
-      "module": "es2015",
+      "module": "esnext",
       "types": ["react-native", "jest"],
       "lib": [
         "es2019",

Verify it is fix by running yarn tsc again

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 12, 2024
@mateoguzmana mateoguzmana changed the title chore(typescript): upgrading module version to esnext Upgrading typescript-config module version to esnext Dec 12, 2024
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeScript config does not support dynamic imports
2 participants