[Question] What's the best practices of shared dependencies?
See original GitHub issue- Include all dependencies in shared
const { dependencies } = require('./package.json');
{
shared: {
...dependencies,
react: {
singleton: true,
requiredVersion: dependencies['react'],
},
'react-dom': {
singleton: true,
requiredVersion: dependencies['react-dom'],
},
},
}
This seems will end up with too many chunks, feels a bit overwhelming as it leads to a lot more requests.
- Only include necessary ones, like those need to be
singleton
and those large dependencies
{
shared: {
component-library: {
requiredVersion: '^x.x.x',
},
'@apollo/client': {
requiredVersion: '^x.x.x',
},
react: {
singleton: true,
requiredVersion: dependencies['react'],
},
'react-dom': {
singleton: true,
requiredVersion: dependencies['react-dom'],
},
},
}
Then we would need to carefully sync the required versions so that each federated module compatible with each other
- Only include those need to be
singleton
{
react: {
singleton: true,
requiredVersion: dependencies['react'],
},
'react-dom': {
singleton: true,
requiredVersion: dependencies['react-dom'],
},
},
}
I understand it is different case by case, but would be nice to see what other people think 😃
Issue Analytics
- State:
- Created a year ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
A question about best practice on multiple dependency jar ...
A good practice I recommend is to use enforcer Plugin with dependency convergence goal. This way you are forced to decide which version...
Read more >Intro to Microservices, Part 4: Dependencies and Data ...
Learn the basics of dependency management and data sharing for ... We will now study how some of these questions are answered in...
Read more >Dependencies in Project Management
The four internal dependencies are based on logic, resources, preferences and best practices, and cross-team dependencies.
Read more >For nodejs what are best design practices for native ...
Prompted by rsms I'd like to share the architecture I'm going with now originally answered/shared here on stackoverflow. What's the best way ...
Read more >AWS CloudFormation best practices
Use best practices to help you use AWS CloudFormation more effectively and securely. ... Use cross-stack references to export shared resources.
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
Consider booking a call. This is tricky to document.
Free of charge. I’ll record the session and post it back here for others.
Easier to talk than write. I cannot read very well so it’s difficult to keep track of the words.
https://calendly.com/d/dwg-3cb-75w/private-session
Just to be clear, For an comprehensive example of an react-redux app, instead of the below code, https://github.com/module-federation/module-federation-examples/blob/5142c518b29e6ec94216e3c895d448cff3e2ef10/comprehensive-demo/app-01/webpack.config.js#L61-L75 the correct way to do this is?
core-js/
bundle the polyfill that not in host app initial chunk?