Skip to content

Commit acd69db

Browse files
authored
fix: always include AssetRegistry and AssetSourceResolver (#1134)
* fix: forcefully include modules used by assetsloader * chore: changeset
1 parent 90be891 commit acd69db

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

.changeset/giant-shoes-scream.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@callstack/repack": patch
3+
---
4+
5+
Always include AssetRegistry and AssetSourceResolver in the bundle
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* This module is added as an entry module to prevent stripping of these React Native deep imports from the bundle.
3+
* We use require.resolve from Rspack/Webpack to ensure these modules are included even if not directly used.
4+
* This allows us to include the modules into the bundle without evaluating them.
5+
* These modules are required by assetsLoader and should be shared as deep imports when using ModuleFederation.
6+
*/
7+
8+
require.resolve('react-native/Libraries/Image/AssetRegistry');
9+
require.resolve('react-native/Libraries/Image/AssetSourceResolver');

packages/repack/src/plugins/NativeEntryPlugin.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,13 @@ export class NativeEntryPlugin implements RspackPluginInstance {
5757
'../modules/InitializeScriptManager.js'
5858
);
5959

60+
const includeModulesPath = require.resolve('../modules/IncludeModules.js');
61+
6062
const nativeEntries = [
6163
...getReactNativePolyfills(),
6264
initializeCorePath,
6365
initializeScriptManagerPath,
66+
includeModulesPath,
6467
];
6568

6669
compiler.hooks.entryOption.tap(

0 commit comments

Comments
 (0)