webpack-clean-obsolete-chunks
webpack-clean-obsolete-chunks copied to clipboard
webpack 5 chunks array depreciation
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
I'm getting the same warning. It seems like you know enough to send a PR?
I am busy with other work, I'll work on it, as soon as possible.
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
@JohnnyFun I don't see the option you mentioned in the docs...
I see the mention of the clean-webpack-plugin
only here
hmm, that link takes me to something that looks like this:
@JohnnyFun yeah, now I see it, lol
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