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.1.3 chunk.files.delete #42

Open
codebygs opened this issue Oct 21, 2020 · 6 comments
Open

Webpack 5.1.3 chunk.files.delete #42

codebygs opened this issue Oct 21, 2020 · 6 comments

Comments

@codebygs
Copy link

I'm getting this error when running production build with with FixStyleOnlyEntriesPlugin. Should I provide some more info?

HookWebpackError: chunk.files.delete is not a function
    at makeWebpackError (/home/vagrant/code/perkam/perkamkopa/node_modules/webpack/lib/HookWebpackError.js:49:9)
    at /home/vagrant/code/perkam/perkamkopa/node_modules/webpack/lib/Compilation.js:1995:11
    at eval (eval at create (/home/vagrant/code/perkam/perkamkopa/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:17:1)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
-- inner error --
TypeError: chunk.files.delete is not a function
    at Compilation.renameAsset (/home/vagrant/code/perkam/perkamkopa/node_modules/webpack/lib/Compilation.js:2957:23)
    at /home/vagrant/code/perkam/perkamkopa/node_modules/webpack/lib/optimize/RealContentHashPlugin.js:284:21
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
    at async Promise.all (index 2)
    at async /home/vagrant/code/perkam/perkamkopa/node_modules/webpack/lib/optimize/RealContentHashPlugin.js:256:6
caused by plugins in Compilation.hooks.processAssets
TypeError: chunk.files.delete is not a function
    at Compilation.renameAsset (/home/vagrant/code/perkam/perkamkopa/node_modules/webpack/lib/Compilation.js:2957:23)
    at /home/vagrant/code/perkam/perkamkopa/node_modules/webpack/lib/optimize/RealContentHashPlugin.js:284:21
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
    at async Promise.all (index 2)
    at async /home/vagrant/code/perkam/perkamkopa/node_modules/webpack/lib/optimize/RealContentHashPlugin.js:256:6
@fqborges
Copy link
Owner

The best you can do is create a demo repository with a minimal reproducible example.

Webpack 5 support is still crude. Most of people (as I do) still uses webpack 4.

Also, there is no specific tests for webpack 5 yet, since I had issues trying to use multiple versions of webpack on the tests.

@devmgn
Copy link

devmgn commented Oct 22, 2020

I was able to get around it by changing the file name [contenthash] to some other value.
(ex: [hash])

@codebygs
Copy link
Author

@fqborges here is the repo: https://github.com/thesame-/webpack-fix-style-only-entries-webpack-5-issue

@Locheed
Copy link

Locheed commented Nov 6, 2020

Webpack 5 will use a real hash of the file content when using [contenthash] now. Before it "only" used a hash of the internal structure. This can be positive impact on long term caching when only comments are changed or variables are renamed. These changes are not visible after minimizing.

This seems to be the cause of issue. devmgn's solution worked for now.

@codebygs
Copy link
Author

codebygs commented Nov 6, 2020

@Locheed Can you elaborate please? I'm new to Webpack. Will changing contenthash to hash work? Does it mean every filename will change on each build?

@cabralRodrigo
Copy link

@thesame- I'm facing the same issue, and yes, using [hash] every filename will change on each build.

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

5 participants