Shared configuration is not supported when dynamic load remote module ??
See original GitHub issuewebpack.config.js
shared: {
react: {eager: true, singleton: true, requiredVersion: '^16.13.1'},
'react-dom': {
eager: true,
singleton: true,
requiredVersion: '^16.13.1',
},
'react-router-dom': {requiredVersion: '^5.1.2'},
'mobx-react-lite': {requiredVersion: '^1.5.2'},
mobx: {requiredVersion: '^5.15.4'},
axios: {requiredVersion: '^0.19.2'},
}
when i dynamic loading remote module, it throw error:
Then i find the error is the ‘factory’ is not a function, it return a Promise
and then i find the step of register shared module, it use ‘webpack_require.e’, not use ‘webpack_require’, it will return a Promise
How can I solve this problem ?
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Webpack module federation is not working with eager shared ...
I used dynamic load technique for my remote library and it seems shared modules are not being fetched again and again now.
Read more >4 Ways to Use Dynamic Remotes in Module Federation
In a previous post, we discussed configuring a simple React application using Webpack Module Federation in a host-remote configuration.
Read more >Let's Dynamic Remote modules with Webpack Module ...
Configuring the Host App; Load script from remote module dynamically; Load Component from webpack share scope; Consume remote component from ...
Read more >Module Federation - webpack
This object is used as a shared scope in the remote container and is filled with the provided modules from a host. It...
Read more >Getting Out of Version-Mismatch-Hell with Module Federation
Also, these versions might not be compatible with each other. ... when the dynamic micro frontend is loaded, module federation does not find ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If remote set to
eager:true
, local should also set toeager:true
, also bootstrap is needed to make sure only one react is in the initial chunk. Also don’t forget to usebundle-loader
or for most new cases just add"module": "esnext"
to tsconfig, otherwise typescript will have problem on dynamic import.@ScriptedAlchemy I feel most people don’t understand what
eager consumption
means, maybe it’s better to have a wiki explaining what it really means? If we don’t understand, when we meet the issue, we can only treat it as black box, and try randomly.