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
{{ message }}
Repository navigation
Commit 7b4efe4
Browse filesBrowse the repository at this point in the historyBrowse files
feat(repack)!: enable package exports by default in getResolveOptions
Metro has resolved package exports by default since React Native 0.79, and
React Native 0.87+ depends on them, so getResolveOptions now defaults
enablePackageExports to true. Pass false to resolve through main fields only.
Also fix ReanimatedPlugin's warning filter, which no longer matched the
setUpTests message from Reanimated 4's Jest utilities after it gained a
[Reanimated] prefix.
Fix `ReanimatedPlugin` not hiding the `setUpTests` / `Critical dependency: require function` warning from Reanimated 4's Jest utilities, whose message is now prefixed with `[Reanimated] `.
`getResolveOptions()` now enables package exports by default (`enablePackageExports: true`), matching Metro's default since React Native 0.79. Pass `enablePackageExports: false` to keep resolving through main fields only.
Whether to enable Package Exports support. When enabled, uses the `exports` field in `package.json` instead of main fields.
34
34
35
35
:::warning
36
-
React Native 0.88 requires `enablePackageExports: true` in your Re.Pack resolver configuration. Its `react-native/setup-env` and `react-native/react-private-interface` entry points, as well as `@react-native/asset-utils`, use package exports.
36
+
React Native 0.88 requires package exports, so don't set `enablePackageExports: false` there. Its `react-native/setup-env` and `react-native/react-private-interface` entry points, as well as `@react-native/asset-utils`, use package exports.
37
37
38
38
Enabling package exports can change how existing dependencies resolve. For more details, please refer to the [Module Resolution guide](/docs/features/module-resolution).
Copy file name to clipboardExpand all lines: website/src/latest/docs/features/module-resolution.md
+7-9Lines changed: 7 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,9 +22,7 @@ import * as Repack from "@callstack/repack";
22
22
exportdefault (env) => {
23
23
return {
24
24
resolve: {
25
-
...Repack.getResolveOptions(env.platform, {
26
-
enablePackageExports: true,
27
-
}),
25
+
...Repack.getResolveOptions(env.platform),
28
26
},
29
27
};
30
28
};
@@ -105,7 +103,7 @@ Main fields are `package.json` properties that point to a package's entry file.
105
103
106
104
:::
107
105
108
-
When resolving a package's entry point, Re.Pack checks these fields in `package.json` in order:
106
+
When a package has no `exports` field, or [package exports](#package-exports-conditional-exports) are disabled, Re.Pack resolves its entry point by checking these fields in `package.json` in order:
109
107
110
108
1.`react-native` — React Native-specific entry point
111
109
2.`browser` — Browser-compatible entry point
@@ -146,15 +144,15 @@ Modern packages use the `exports` field in `package.json` to define entry points
146
144
147
145
:::caution
148
146
149
-
Package exports support is **disabled by default** (`enablePackageExports: false`) to maintain backwards compatibility with existing React Native projects. React Native 0.87 requires it for `@react-native/asset-utils`, and 0.88 also for `react-native/setup-env` and `react-native/react-private-interface`. Enable it explicitly for React Native 0.87 and newer, or whenever your dependencies require it. The configuration templates used by `@callstack/repack-init` enable it.
147
+
Package exports support is **enabled by default** (`enablePackageExports: true`), matching Metro's default since React Native 0.79. React Native 0.87 requires it for `@react-native/asset-utils`, and 0.88 also for `react-native/setup-env` and `react-native/react-private-interface`, so only disable it if your React Native version and dependencies don't need it.
150
148
151
149
:::
152
150
153
-
### Enabling package exports
151
+
### Disabling package exports
154
152
155
153
```ts
156
154
Repack.getResolveOptions({
157
-
enablePackageExports: true,
155
+
enablePackageExports: false,
158
156
});
159
157
```
160
158
@@ -277,7 +275,7 @@ export default (env) => {
277
275
278
276
1.**Check the package's `package.json`** — Look at `main`, `react-native`, `browser`, and `exports` fields
279
277
2.**Verify platform extensions** — Ensure platform-specific files use correct naming (`.ios.js`, not `.iOS.js`)
280
-
3.**Check `enablePackageExports`** — Some modern packages require this to be `true`
278
+
3.**Check `enablePackageExports`** — Some modern packages require this to be `true` (the default)
281
279
282
280
### Platform-specific files not being picked up
283
281
@@ -287,7 +285,7 @@ export default (env) => {
287
285
288
286
### Package exports compatibility issues
289
287
290
-
When enabling `enablePackageExports`, some packages may resolve differently:
288
+
With `enablePackageExports` enabled, some packages may resolve differently than with main fields only:
291
289
292
290
1.**Compare with Metro** — Test the same import in a Metro-bundled project
293
291
2.**Check condition order** — The `react-native` condition should take precedence
Copy file name to clipboardExpand all lines: website/src/latest/docs/migration-guides/repack-v5.mdx
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,19 @@ Update the Re.Pack plugins you use (`@callstack/repack-plugin-*`) to the same ma
28
28
29
29
React Native 0.82 removed the legacy architecture, so Re.Pack's native module is now built only as a TurboModule. If your app still sets `newArchEnabled=false`, migrate it to the [New Architecture](https://reactnative.dev/architecture/landing-page) before upgrading.
30
30
31
+
## Package exports are enabled by default
32
+
33
+
`getResolveOptions()` now sets `enablePackageExports` to `true` by default, matching Metro's default since React Native 0.79. Configs that already pass `enablePackageExports: true` don't need changes. If your project relies on main-field resolution, opt out explicitly:
See [Module Resolution](/docs/features/module-resolution#package-exports-conditional-exports) for how package exports change resolution.
43
+
31
44
## Module Federation V1 was removed
32
45
33
46
`ModuleFederationPluginV1` is no longer available, and `Repack.plugins.ModuleFederationPlugin` now points to [`ModuleFederationPluginV2`](/api/plugins/module-federation-v2). Follow [Migrating from V1](/docs/features/module-federation#migrating-from-v1) to move your configs to Module Federation 2.0.
0 commit comments