-
Notifications
You must be signed in to change notification settings - Fork 512
feat: DeprecationWarning: Chunk.modules in Webpack 3.x #529
Comments
It doesn't work at all or does it just displays a warning for an unmet peerDepedency? |
It's working with webpack 3.0. It does emit this warning however:
|
Change line 271 to this: It solved the issue for me (ran 3 tests, might need a bit more testing). The Array.from() is specifically to counter an issue I have had in the past with several linux distros not liking "array-like" structures (such as arrays built from mapping). |
@d3viant0ne Should a put a pull request in? It's not exactly urgent, but this is the most resource independent way to avoid this warning and making it work more effectively for Webpack 3. |
Yes feel free to send PR :) for discussion && finishing details |
Everyone - The change throwing the deprecation warning looks like it isn't going to be backwards compatible with This is going to have to go out as a |
@MirrorBytes I remember this being an older NodeJS issue that cropped up in Fedora for me iirc. It's also something I haven't seen in quite a while and don't believe it to be a relevant issue for our supported If you know of an instance where that isn't the case, I'll configure the applicable vm to verify the need for |
@MirrorBytes - If you want to PR in the changes for the deprecation warnings, you need to fork off of & target this branch .... https://github.com/webpack-contrib/extract-text-webpack-plugin/tree/feature/webpack3 |
Sorry for the delay. I removed Array.from() and submitted a pull request for Webpack-3 branch. |
(node:19215) DeprecationWarning: Chunk.modules is deprecated. Use Chunk.getNumberOfModules/mapModules/forEachModule/containsModule instead. just to modify node_modules/_extract-text-webpack-plugin@2.1.2@extract-text-webpack-plugin/index.js: |
This is a known issue & already has a PR to resolve it. It's a Major so you will have to use the etwp See #540 for the particulars |
Closed by be7936d |
Well, thanks @d3viant0ne & @michael-ciniawsky The warning is gone and app works just fine. |
@d3viant0ne I still have the warning "DeprecationWarning: Chunk.modules is deprecated. Use Chunk.getNumberOfModules/mapModules/forEachModule/containsModule instead." My package.json: https://github.com/ova2/angular-development-with-primeng/blob/master/angular-primeng-seed-for-authors/package.json Simple try to execute |
@ova2 Please update to latest |
@irowbin I already have |
@ova2 Its wired that author himself having this deprecation warning 🤣 . Mine works fine after i did some cleanup and re-install. I was seeing this error till the node npm webpack extract-text-webpack-plugin |
I updated to webpack 3.2.0 and extract-text-webpack-plugin 3.0.0 deleted and installed node_modules again and I still get this warning. |
Cannot reproduce this, all works fine with Try to clear caches. yarn cache clean
# or
npm cache clean --force |
Tried it . Unfortunately I am sill getting the message. |
FYI - if you use webpack-chunk-hash (or webpack-md5-hash), the deprecation warning may be coming from it: alexindigo/webpack-chunk-hash#9 |
@Igor-Vuk @ova2 Could you both please share your WarningsPlugin.js class WarningsPlugin {
constructor (options = {}) {
this.options = options
}
apply(compiler) {
compiler.plugin('this-compilation', (compilation, cb) => {
process.on('warning', (warning) => {
console.warn('\n⚠️ Warnings Plugin\n\n')
console.warn(`${warning.name}\n`)
console.warn(`${warning.message}\n`)
console.warn(`${warning.stack)\n`)
});
})
}
} Before
After⚠️ Warnings Plugin
DeprecationWarning
Chunk.modules is deprecated. Use Chunk.getNumberOfModules/mapModules/forEachModule/containsModule instead.
at NamedChunksPlugin.env.production.NamedChunksPlugin [as nameResolver] (.../.webpack/plugins.js:17:19)
at chunks.forEach (.../node_modules/webpack/lib/NamedChunksPlugin.js:22:23)
at Array.forEach (native)
at Compilation.compilation.plugin (.../node_modules/webpack/lib/NamedChunksPlugin.js:20:12)
at Compilation.applyPlugins1 (.../node_modules/tapable/lib/Tapable.js:75:14)
at sealPart2 (.../node_modules/webpack/lib/Compilation.js:606:9)
at Compilation.applyPluginsAsyncSeries (.../node_modules/tapable/lib/Tapable.js:131:46)
at Compilation.seal (.../node_modules/webpack/lib/Compilation.js:579:8)
at applyPluginsParallel.err (.../node_modules/webpack/lib/Compiler.js:514:17)
at .../node_modules/tapable/lib/Tapable.js:225:11
at _addModuleChain (.../node_modules/webpack/lib/Compilation.js:481:11)
at processModuleDependencies.err (.../node_modules/webpack/lib/Compilation.js:452:13)
at _combinedTickCallback (internal/process/next_tick.js:95:7)
at process._tickCallback (internal/process/next_tick.js:161:9)
|
@weaverryan Thanks a lot! The warning came from webpack-md5-hash. I've removed this plugin and the warning is gone. No issues more. |
@weaverryan @michael-ciniawsky @ova2 |
@Igor-Vuk I don't know why I was using it. I've realized I can live without this plugin - the Webpack generated hashes are fine. |
@ova2 |
@Igor-Vuk I use manifest and manifest.js file + Webpack records // See https://medium.com/webpack/harnessing-the-power-of-webpack-2cd0e20ff1bf#.q9do1u54o The hash of polyfill is fine after rebuild (I don't have a vendor file because it is merged together with main file due to better tree shaking). |
https://medium.com/webpack/predictable-long-term-caching-with-webpack-d3eee1d3fa31 const { NamedChunksPlugin, NamedModulesPlugin } = require('webpack')
...
[
new NamedModulesPlugin(),
new NamedChunksPlugin((chunk) => {
if (chunk.name) return chunk.name
return chunk
- .modules.map(({ context, request }) => path.relative(context, request)
+ .mapModules(({ context, request }) => path.relative(context, request)) // <= webpack >= 3
.join('_')
}),
new CommonsChunkPlugin({
name: [ 'vendor', 'runtime' ],
minChunks: Infinity
}),
...ExtractTextPlugin, ModuleConcatenationPlugin
] Third-party Plugins are not needed most of the time imho :) |
I personally use md5-hash but I have a rather complex nginx setup related to what is & is not cached and for how long. Outside of situations where your operational requirements warrant the added complexity, @michael-ciniawsky is right, you really don't need it. |
guys how do you find and remove webpack-md5-hash in my webpack |
@ayepRahman - Should be listed in your project devDependencies. If you don't see it there, it's a dependency of a dependency. That said, if you are using someone's boilerplate project, removing that lib is likely going to break your production build. |
I'm still getting the warning.
|
This is not from |
I'm still getting the warning. |
@oguzhanabali Read the comment directly above yours. The warning will be emitted by any plugin using the now deprecated |
Webpack 3.0-rc was released and this plugin currently doesn't support it.
I haven't tested it, it might be just a question of updating the peerDependency.
The text was updated successfully, but these errors were encountered: