Open adirzoari opened 9 months ago
The projects should successfully run with module federation configured, and no "Loading script failed" error should occur.
Encounter the error "Loading script failed" when trying to run the host and remote projects with module federation configured.
When I run each of them alone:
npm run build & npm run preview
screenshot:
same issue to me, any solution?
Same issue for me! Have you found any solution?
Is there an update on this issue? I have also his problem
Versions
Steps to reproduce
What is Expected?
The projects should successfully run with module federation configured, and no "Loading script failed" error should occur.
What is actually happening?
Encounter the error "Loading script failed" when trying to run the host and remote projects with module federation configured.
When I run each of them alone:
npm run build & npm run preview
) alone successfully shows the project.screenshot:
Additional Details
#### Host Project - `config-overrides.js` ```javascript // Your config-overrides.js content goes here `const path = require('path'); const hashValue = Date.now(); const { dependencies } = require('./package.json'); const { ModuleFederationPlugin } = require('webpack').container; module.exports = { experiments: { outputModule: true, }, webpack: function (config, env) { config.output.filename = `[name].${hashValue}.js`; config.output.chunkFilename = `[name].${hashValue}.chunk.js`; config.output.path = path.join(__dirname, 'build'); config.output.publicPath = 'auto'; config.plugins = [ ...config.plugins, new ModuleFederationPlugin({ name: 'HostPoc', remotes: { PrimeDev: 'PrimeDev@http://localhost:4173/assets/remoteEntry.js', }, shared: ['react', 'react-dom', 'react-router-dom'], }), ]; return config; }, }; ` #### Host project import the remote ```javascript const PrimeDev = React.lazy(() => import('primeDev/App')); ... ... ..