Webpack 5 throws DeprecationWarning
See original GitHub issueBug report
Describe the bug
Using Webpack 5 with the official support shipped in Next.js 9.5, Webpack throws a few DeprecationWarnings when I run my app:
[DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK] DeprecationWarning: Compilation.hooks.normalModuleLoader was moved to NormalModule.getCompilationHooks(compilation).loader
[DEP_WEBPACK_MAIN_TEMPLATE_RENDER_MANIFEST] DeprecationWarning: MainTemplate.hooks.renderManifest is deprecated (use Compilation.hooks.renderManifest instead)
[DEP_WEBPACK_CHUNK_TEMPLATE_RENDER_MANIFEST] DeprecationWarning: ChunkTemplate.hooks.renderManifest is deprecated (use Compilation.hooks.renderManifest instead)
[DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK] DeprecationWarning: MainTemplate.hooks.hashForChunk is deprecated (use JavascriptModulesPlugin.getCompilationHooks().chunkHash instead)
[DEP_WEBPACK_COMPILATION_OPTIMIZE_CHUNK_ASSETS] DeprecationWarning: optimizeChunkAssets is deprecated (use Compilation.hook.processAssets instead and use one of Compilation.PROCESS_ASSETS_STAGE_* as stage option)
[DEP_WEBPACK_DEPRECATION_ARRAY_TO_SET] DeprecationWarning: Compilation.chunks was changed from Array to Set (using Array method 'reduce' is deprecated)
[DEP_WEBPACK_DEPRECATION_ARRAY_TO_SET_LENGTH] DeprecationWarning: chunk.files was changed from Array to Set (using Array property 'length' is deprecated)
[DEP_WEBPACK_DEPRECATION_ARRAY_TO_SET_INDEXER] DeprecationWarning: chunk.files was changed from Array to Set (indexing Array is deprecated)
[DEP_WEBPACK_COMPILATION_ASSETS] DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated.
BREAKING CHANGE: No more changes should happen to Compilation.assets after sealing the Compilation.
Do changes to assets earlier, e. g. in Compilation.hooks.processAssets.
Make sure to select an appropriate stage from Compilation.PROCESS_ASSETS_STAGE_*.
[DEP_WEBPACK_MODULE_ID] DeprecationWarning: Module.id: Use new ChunkGraph API
[DEP_WEBPACK_MODULE_UPDATE_HASH] DeprecationWarning: Module.updateHash: Use new ChunkGraph API
[DEP_WEBPACK_CHUNK_MODULES_ITERABLE] DeprecationWarning: Chunk.modulesIterable: Use new ChunkGraph API
[DEP_WEBPACK_CHUNK_GROUP_GET_MODULE_INDEX_2] DeprecationWarning: ChunkGroup.getModuleIndex2 was renamed to getModulePostOrderIndex
[DEP_WEBPACK_EXTERNALS_FUNCTION_PARAMETERS] DeprecationWarning: The externals-function should be defined like ({context, request}, cb) => { ... }
However, the app still runs fine. I just think these should be fixed/hidden.
To Reproduce
Clone the development
branch of this repository. These warnings appear in development mode and at build time, I also deployed to Vercel where they showed up as well.
Expected behavior
I would expect there to be no warnings thrown.
System information
- OS: Windows
- Browser: Chrome
- Version of Next.js: 9.5.0
- Version of Node.js: v12.16.3
Additional context
I tried updating to 9.5.1-canary.0, but now the app won’t run. I’ll open another issue about this.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Webpack 5 Deprecation Warnings - Edgio Community Forums
When I build my application, I see webpack warnings like: Bundling ./src/routes.ts and xdn.config.js.
Read more >Resolve Webpack 5.9.0 deprecation calls ... - Stack Overflow
I am using it like so (which I learned from following: https://survivejs.com/webpack/styling/eliminating-unused-css/):
Read more >deprecationwarning: compilation.hooks.normalmoduleloader ...
js 9.5, Webpack throws a few DeprecationWarnings when I run my app: [DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK] DeprecationWarning: Compilation.hooks.
Read more >DevServer - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >Porting to the Buffer.from() / Buffer.alloc() API - Node.js
The migration fixes the following deprecation warning: ... The Node.js 5.x release line has been unsupported since July 2016, and the Node.js 4.x...
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
For me the solution was to update “mini-css-extract-plugin” to version “1.3.9”
if you’re using yarn
Run: yarn upgrade-interactive --latest
and select all the ones in red, select them with the spacebar and navigate through them with up and down arrow keys.
Hope this helps someone