You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/pages/esm.md
+4-3
Original file line number
Diff line number
Diff line change
@@ -18,17 +18,18 @@ You can verify whether ESM support is enabled by checking the configuration for
18
18
19
19
The `"esm": true` option enables ESM-compatible output by adding the `.js` extension to the import statements in the generated files. For TypeScript, it also generates 2 sets of type definitions: one for the CommonJS build and one for the ES module build.
20
20
21
-
It's recommended to specify `"moduleResolution": "Bundler"` in your `tsconfig.json` file as well:
21
+
It's recommended to specify `"moduleResolution": "Bundler"`and `"resolvePackageJsonImports": false`in your `tsconfig.json` file to match [Metro's behavior](https://reactnative.dev/blog/2023/06/21/package-exports-support#enabling-package-exports-beta):
22
22
23
23
```json
24
24
{
25
25
"compilerOptions": {
26
-
"moduleResolution": "Bundler"
26
+
"moduleResolution": "Bundler",
27
+
"resolvePackageJsonImports": false
27
28
}
28
29
}
29
30
```
30
31
31
-
This means that you don't need to specify the file extension in the import statements. They'll be automatically added when possible during the build process.
32
+
Specifying `"moduleResolution": "Bundler"`means that you don't need to use file extensions in the import statements. Bob automatically adds them when possible during the build process.
32
33
33
34
To make use of the output files, ensure that your `package.json` file contains the following fields:
0 commit comments