Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack 4 - DeprecationWarning: Chunk.mapModules #17

Open
mtraynham opened this issue Mar 1, 2018 · 5 comments
Open

Webpack 4 - DeprecationWarning: Chunk.mapModules #17

mtraynham opened this issue Mar 1, 2018 · 5 comments

Comments

@mtraynham
Copy link
Collaborator

mtraynham commented Mar 1, 2018

Webpack 4 is complaining of a deprecation warning:

(node:8040) DeprecationWarning: Chunk.mapModules: Use Array.from(chunk.modulesIterable, fn) instead

I believe it relates to this particular line. Hopefully I can get around to a PR for this.

@alexindigo
Copy link
Owner

Hey, thanks for your interest.
I'm curious what is the use case for this module with webpack@4?

Reason I'm asking: It was created as workaround to shortcomings of webpack@2, and webpack@3 should have addressed that issues.

Thank you.

@mtraynham
Copy link
Collaborator Author

mtraynham commented Mar 1, 2018

So, this is a good question as I can't particularly remember why I've kept using it, but only that it was consistent in producing the same hashes across builds, and even today it seems to do so, where Webpack does not.

I removed this plugin as a test and it seems intermittent that I get different chunkhash's across builds. I'm not sure if that's related to webpack/webpack#6623, which is fairly recent, but without the webpack-chunk-hash plugin, I'll get vendor files (using CommonChunk) named like follows:

vendor.717d59f0f1b557550a73.js
vendor.dfddbf05091859520abd.js
vendor.dfddbf05091859520abd.js
vendor.93e1357c712b12c0e2d8.js
vendor.93e1357c712b12c0e2d8.js
vendor.d0ebd85ac7dae6032076.js

Interestingly enough, the main entry point always seems to be consistent.
main.c381d39105dbce0ae67f.js

I am using the NamedModulesPlugin, according to the best practices of these articles, 1 & 2, to ensure consistent filenames across builds, so I'm not sure where the discrepancy is actually happening.

Alternatively, using the webpack-chunk-hash, I consistently get a vendor file named:
vendor.9d8d7f9533a6694420fc.js

Functionally, I don't really understand when Webpack is generating that chunkhash or what it's actually using to create a hash, but if I were to take an educated guess, I assume it's not on the input of the code and rather on some form of the output which any number of plugins or loaders could change.

@KevinGrandon
Copy link

Yeah, we're seeing the same thing, inconsistent hashing in webpack 4, though this module fixes it for us. We'd love to continue using this with webpack 4, thanks for working on a fix!

@anthonybrown
Copy link

I'm seeing the same error, is this fixed now?

@mtraynham
Copy link
Collaborator Author

mtraynham commented Jun 6, 2018

@anthonybrown This should be fixed in 0.6.0. If you see the same error, add stack traces when running webpack with node the node trace-deprecation flag, i.e. node --trace-deprecation ./node_modules/bin/webpack ..... This will help identify which module and line numbers you're seeing the error for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants