Webpack Module Federation Error ScriptExternalLoadError: Loading script failed
Asked Answered
S

1

8

My host is throwing this error.

enter image description here

NOTE: I tried accessing this directly in the browser https://localhost:5007/accom-web/dist/js/assets/browser-bundle/remoteEntryTest.js and I'm served the remoteEntryTest.js file.

This is my webconfig in host.

enter image description here

This is webconfig of remote application.

enter image description here

Optimization config for remote application is below.

optimization: {
    runtimeChunk: false,
    emitOnErrors: true,
    splitChunks: {
       minSize: 256000,
       minChunks: 1,
       maxAsyncRequests: 10,
       automaticNameDelimiter: '-',
       cacheGroups: {
           chunks: 'initial',
           .....
       },
    },
    .....
}

I looked at the GitHub issues regarding this too but didn't help much.

https://github.com/module-federation/module-federation-examples/issues/307 https://github.com/module-federation/module-federation-examples/issues/1273 https://github.com/module-federation/module-federation-examples/issues/692

Any suggestions on this how to fix it?

Spilt answered 31/5, 2022 at 15:38 Comment(2)
any solution for this error ?Dickson
same issue, any solution for this error please?Damson
L
9

I had a similar issue with specifying shared dependencies on a remote. I ended up having to disable splitChucks after reviewing your Github references. I'm sure you tried that as well but this got my remote working again recently.

optimization: {
        splitChunks: false,
    },
Lotson answered 24/6, 2022 at 16:41 Comment(6)
hi @jaskru where to add optimizationDickson
@GopinathKaliappan Inside webpack config.Superimpose
What if need both SplitChunks as well as Remote??Circadian
What about Vite?, it doesn't have that option.Teeter
@Teeter did you find solution for vite?Perigynous
Tried this does not work. Webpack 5.18. ReactJS.Unformed

© 2022 - 2024 — McMap. All rights reserved.