webpack: Cannot get final name for export "default" in "delegated ..." with Webpack 3 scope hoisting
Do you want to request a feature or report a bug?
Bug report.
What is the current behavior?
This error occured when upgrading to webpack 3 and added scope hoisting using the new webpack.optimize.ModuleConcatenationPlugin()
(line 92 in webpack.config.js).
When trying to build the project, app part, the one referencing the dlls, breaks with the following error:
ERROR in chunk js [entry]
app-[hash].js
Cannot get final name for export "default" in "delegated ./node_modules/lodash-es/_freeGlobal.js from dll-reference vendor_369f235e615c7d44cdbc" (known exports: true, known reexports: )
If the current behavior is a bug, please provide the steps to reproduce.
Repo reproducing the bug with steps to reproduce: https://github.com/markogresak/webpack-3-bug.
Without adding the scope hoisting plugin, it works fine, even with the webpack 3 update. I’m not sure if there is a problem with the library or webpack itself. If there is a hack I could add to the config to avoid this error, that would work too.
What is the expected behavior?
The webpack
command should not fail.
Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.
Browser version: N/A Node version: 8.1.2 Webpack version: 3.0.0 OS: macOS Sierra 10.12.5
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 13
- Comments: 19 (1 by maintainers)
Commits related to this issue
- Make sure it's a real module when choosing for ModuleConcatenation fixes #5095 — committed to webpack/webpack by sokra 7 years ago
Addingcontext
to vendorDllPlugin
solved it for me:My comment was actually misleading DllPlugin context so it would bundle without making use of the vendor bundle (dll) that’s why the error was gone.
Ran into this today. Some of my findings:
import from 'react-router'
andimport from 'react-router-dom'
at the same time, and the error message is complaining about:node_modules/react-router/es/index.js
is:react-router-dom
and it seems fixed the error.The warnings by CLI arg
--display-optimization-bailout
are still exists but it finally compiles and outputs the bundle.Thanks for fixing this. I did tested v3.4.1 and it works perfectly. No code changes were necessary.
Are there any leads on this? It’s blocking Pinterest from upgrading as well. I might be able to help but not sure where to start.