Webpack 5 recently released, and @DylanPiercey asked if I had run into any compat issues when trying to upgrade.
Answer: yes.
Expected Behavior
A successful Webpack 4 config without deprecation warnings should successfully complete a build after upgrading to "webpack": "^5".
Actual Behavior
Errors are thrown and a deprecation message is shown.
Your Environment
Environment name and version (e.g. Chrome 39, node.js 5.4): Node.js v14.6.0
Operating System and version (desktop or mobile): MacOS
Steps to Reproduce
Check out the @marko/webpack sample repo
Change the "webpack" version in its package.json to "^5"
Run the build
Stack Trace
~/repo/node_modules/webpack-virtual-modules/index.js:84
if (storage.data instanceof Map) {
^
TypeError: Cannot read property 'data' of undefined
at setData (~/repo/node_modules/webpack-virtual-modules/index.js:84:15)
at CachedInputFileSystem.finalInputFileSystem._writeVirtualFile (~/repo/node_modules/webpack-virtual-modules/index.js:118:9)
at VirtualModulesPlugin.writeModule (~/repo/node_modules/webpack-virtual-modules/index.js:64:24)
at ~/repo/node_modules/webpack-virtual-modules/index.js:165:14
at Array.forEach (<anonymous>)
at afterResolversHook (~/repo/node_modules/webpack-virtual-modules/index.js:164:40)
at Hook.eval [as call] (eval at create (~/repo/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:1)
at Hook.CALL_DELEGATE [as _call] (~/repo/node_modules/tapable/lib/Hook.js:14:14)
at WebpackOptionsApply.process (~/repo/node_modules/webpack/lib/WebpackOptionsApply.js:555:33)
at createCompiler (~/repo/node_modules/webpack/lib/webpack.js:78:28)
yarn why confirms the bad version of webpack-virtual-modules is imported by @marko/webpack.
Forcibly upgrading webpack-virtual-modules to 0.3.1 via resolutions fixes the above error, but produces a new one:
TypeError: desc.import is not iterable
at ~/repo/node_modules/webpack/lib/DynamicEntryPlugin.js:56:33
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Also, it produces this trace for a deprecation:
(node:28127) [DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK] DeprecationWarning: Compilation.hooks.normalModuleLoader was moved to NormalModule.getCompilationHooks(compilation).loader
at getNormalModuleLoader (~/repo/node_modules/webpack/lib/Compilation.js:295:39)
at Object.get normalModuleLoader [as normalModuleLoader] (~/repo/node_modules/webpack/lib/Compilation.js:601:12)
at ~/repo/node_modules/@marko/webpack/dist/plugin/index.js:58:35
at Hook.eval [as call] (eval at create (~/repo/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:9:1)
at Hook.CALL_DELEGATE [as _call] (~/repo/node_modules/tapable/lib/Hook.js:14:14)
at Compiler.newCompilation (~/repo/node_modules/webpack/lib/Compiler.js:915:30)
at ~/repo/node_modules/webpack/lib/Compiler.js:957:29
at Hook.eval [as callAsync] (eval at create (~/repo/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (~/repo/node_modules/tapable/lib/Hook.js:18:14)
at Compiler.compile (~/repo/node_modules/webpack/lib/Compiler.js:952:28)
Version: 6.2.9
Details
Webpack 5 recently released, and @DylanPiercey asked if I had run into any compat issues when trying to upgrade.
Answer: yes.
Expected Behavior
A successful Webpack 4 config without deprecation warnings should successfully complete a build after upgrading to
"webpack": "^5"
.Actual Behavior
Errors are thrown and a deprecation message is shown.
Your Environment
Steps to Reproduce
@marko/webpack
sample repo"webpack"
version in itspackage.json
to"^5"
Stack Trace
yarn why
confirms the bad version ofwebpack-virtual-modules
is imported by@marko/webpack
.Forcibly upgrading
webpack-virtual-modules
to 0.3.1 viaresolutions
fixes the above error, but produces a new one:Also, it produces this trace for a deprecation: