External modules are not packaged with webpack 5
See original GitHub issueThis is a Bug Report
Description
Since updating to the release version of webpack 5, it seems like external modules are no longer packaged. I investigated a bit and in packExternalModules#getExternalModules
I don’t see the externals I specify in my webpack config. I checked webpack 5 release notes but could not find a not about that and how to fix it. As a workaround I was able to use stats.compilation.modules
instead of chunks
and it does include the externals. Not sure if this is a proper fix though.
Similar or dependent issue(s): N/A
Additional Data
- Serverless-Webpack Version you’re using: 5.3.5
- Webpack version you’re using: 5.1.3
- Serverless Framework Version you’re using: 2.8.0
- Operating System: MacOS 10.15.7
- Stack Trace (if available): N/A
Issue Analytics
- State:
- Created 3 years ago
- Reactions:34
- Comments:23 (6 by maintainers)
Top Results From Across the Web
Externals - webpack
The externals configuration option provides a way of excluding dependencies from the output bundles. Instead, the created bundle relies on that dependency ...
Read more >Webpack 5 webpackMissingModule error for node_modules ...
In my case it was caused by two webpack@5 versions installed at the same time. Check your package-lock.json / yarn.lock and add overrides/ ......
Read more >webpack-node-externals - npm
Webpack allows you to define externals - modules that should not be bundled. When bundling with Webpack for the backend - you usually...
Read more >Webpack 5 Issues | Documentation - Web3Auth
This issue is caused due to the fact that the web3.js and ethers.js packages have certain dependencies, which are not present within the...
Read more >A Guide to Managing Webpack Dependencies - Toptal
If we need to expose a module to the global context, we can use expose-loader . This can be helpful, for example, if...
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 Free
Top 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
I was able to work around this by disabling
optimization.concatenateModules
(defaults to true in production mode)Same issue related, as @maxholman mentions, this configuration :
work for me !