ScriptExternalLoadError: Loading script failed #13271
-
I'm trying to share a hook between two applications that are in different repositories. I catch error // yes, i install babel plugin and set webpack flag
const useUserLogin = await import("CorpCRM/userUserLogin")
// hub app
new ModuleFederationPlugin({
name: 'CorpCRM',
filename: 'remoteEntry.js',
exposes: {
useUserLogin: './src/hooks/useUserLogin',
},
remotes: {
app2: 'app2@http://localhost:3002/remoteEntry.js',
},
shared: [{ react: { singleton: true }, 'react-dom': { singleton: true } }],
}) // second app
new ModuleFederationPlugin({
name: "app2",
filename: "remoteEntry.js",
remotes: {
CorpCRM: 'CorpCRM@http://localhost:7777/remoteEntry.js',
},
shared: [{ react: { singleton: true }, 'react-dom': { singleton: true }}],
}) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
Try to open |
Beta Was this translation helpful? Give feedback.
-
I have a similar issue. There are two apps (app1 and app2) and everytime I import app1 which is a federated module and try to use methods of the exported content from remote, the value is undefined. And this is leading to the ScriptLoadErrors. |
Beta Was this translation helpful? Give feedback.
Try to open
http://localhost:7777/remoteEntry.js
, looks you have wrong URL