Unable to find MiniApp.container.bundle for iOS in compilation assets
Environment
Operating System: Mac OS Node.js version: 20.10.0 repack version:3.7.0
Description
I am using the super app example and following the article posted on Medium. Both the host app and mini app server run fine, when i attempt to load mini app, into the host app, i encountered an error related to the MiniApp.container.bundle file not being found in the compilation assets
[```
mini-app] ✖ [01:23:39.098Z][DevServer] File MiniApp.container.bundle for ios not found in compilation assets {
[mini-app] reqId: 'req-1',
[mini-app] stack: 'Error: File MiniApp.container.bundle for ios not found in compilation assets\n' +
[mini-app] ' at /super-app-example/packages/mini-app/node_modules/@callstack/repack/dist/webpack/Compiler.js:174:20\n' +
[mini-app] ' at /super-app-example/packages/mini-app/node_modules/@callstack/repack/dist/webpack/Compiler.js:83:52\n' +
[mini-app] ' at Array.forEach (
@paaber please share your ScriptManager config in the host app, ideally also provide a reproduction repository so I can have a look at the code, thanks
thanks for your swift response, @jbroma here is the ScriptManager snippet
import {AppRegistry} from 'react-native'; import App from './src/App'; import {name as appName} from './app.json'; import { ScriptManager, Federated ,} from "@callstack/repack/client"; import { Platform } from 'react-native'; AppRegistry.registerComponent(appName, () => App);
ScriptManager.shared.addResolver(async (scriptId, caller) => { const resolveURL = Federated.createURLResolver({ containers: { MiniApp: "http://localhost:9000/[name][ext]", }, });
const url = resolveURL(scriptId, caller);
if (url) {
return {
url,
query: {
platform: Platform.OS
},
};
}
});
https://github.com/paaber/superapp-repack-reprod.git. this is reproduction repository
@paaber few things to make it work:
- your
Repack.plugins.ModuleFederationPluginis outside of the plugins array in bothwebpack.config.mjsfiles, inhost-appandmini-apppackages, that's why it's not working as expected. - in mini-app config, inside of
exposesyou should use./MiniAppNavigatorinstead of./MiniAppbecause thats what you import in the host-app inpackages/host-app/src/screens/MiniAppScreen.tsxon line 5:
const MiniAppNavigator = React.lazy(() =>
Federated.importModule("MiniApp", "./MiniAppNavigator")
);
Closing this issue since it's not a problem with the library, but rather a configuration error on user's part.