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 5 chunks array depreciation #34

Open
aniketfuryrocks opened this issue Oct 18, 2020 · 7 comments
Open

webpack 5 chunks array depreciation #34

aniketfuryrocks opened this issue Oct 18, 2020 · 7 comments

Comments

@aniketfuryrocks
Copy link

Webpack 5 deprecated chunks array in favour of object.

*/51 > /*
let chunks = compilation.chunks.map(chunk => {
     const copy = Object.assign({}, chunk)
     copy.uniqueId = `${compilationName}--${copy.id}`
     return copy
})

.map needs to be replaced with something related to Object.keys

Errror:

(node:36954) [DEP_WEBPACK_DEPRECATION_ARRAY_TO_SET] DeprecationWarning: Compilation.chunks was changed from Array to Set (using Array method 'map' is deprecated)
    at Set.set.<computed> [as map] (/media/dedsec/Projects/FireJSX/node_modules/webpack/lib/util/deprecation.js:85:4)
    at /media/dedsec/Projects/FireJSX/node_modules/webpack-clean-obsolete-chunks/index.js:51:37
    at Array.reduce (<anonymous>)
    at CleanObsoleteChunks._retrieveAllChunks (/media/dedsec/Projects/FireJSX/node_modules/webpack-clean-obsolete-chunks/index.js:49:23)
    at CleanObsoleteChunks._getObsoleteFiles (/media/dedsec/Projects/FireJSX/node_modules/webpack-clean-obsolete-chunks/index.js:41:23)
    at CleanObsoleteChunks._removeObsoleteFiles (/media/dedsec/Projects/FireJSX/node_modules/webpack-clean-obsolete-chunks/index.js:28:28)
    at Hook.eval [as callAsync] (eval at create (/media/dedsec/Projects/FireJSX/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:7:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/media/dedsec/Projects/FireJSX/node_modules/tapable/lib/Hook.js:18:14)
    at /media/dedsec/Projects/FireJSX/node_modules/webpack/lib/Compiler.js:730:27
    at /media/dedsec/Projects/FireJSX/node_modules/neo-async/async.js:2818:7

Platform : Linux
Webpack : 5.1.3
webpack-clean-obsolete-chunks : 0.4.0

@Philipp91
Copy link

I'm getting the same warning. It seems like you know enough to send a PR?

@aniketfuryrocks
Copy link
Author

I am busy with other work, I'll work on it, as soon as possible.

@JohnnyFun
Copy link

Seems like webpack's native output.clean actually handles what this plugin does. Wonder if this plugin can be deprecated? https://webpack.js.org/configuration/output/#outputclean

@GProst
Copy link
Owner

GProst commented Mar 12, 2021

@JohnnyFun I don't see the option you mentioned in the docs...
I see the mention of the clean-webpack-plugin only here

@JohnnyFun
Copy link

hmm, that link takes me to something that looks like this:
image

@GProst
Copy link
Owner

GProst commented Mar 12, 2021

@JohnnyFun yeah, now I see it, lol

@GProst
Copy link
Owner

GProst commented Mar 12, 2021

Yes, it seems like Webpack 5.20.0 deprecates this plugin. I'm gonna add a note about it when I have time 👍
Thanks for pointing that out @JohnnyFun

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