question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

External modules are not packaged with webpack 5

See original GitHub issue

This 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:closed
  • Created 3 years ago
  • Reactions:34
  • Comments:23 (6 by maintainers)

github_iconTop GitHub Comments

48reactions
maxholmancommented, Oct 29, 2020

I was able to work around this by disabling optimization.concatenateModules (defaults to true in production mode)

23reactions
PaulContremoulincommented, Dec 19, 2020

Same issue related, as @maxholman mentions, this configuration :

optimization: {
        // fix node modules not packaged into zip
        concatenateModules: false
    },

work for me !

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found