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.

Webpack 5 throws DeprecationWarning

See original GitHub issue

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

github_iconTop GitHub Comments

34reactions
stefaneidellothcommented, Mar 25, 2021

For me the solution was to update “mini-css-extract-plugin” to version “1.3.9”

16reactions
Igli7commented, Apr 5, 2021

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

Read more comments on GitHub >

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

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