cascornelissen / svg-spritemap-webpack-plugin

SVG spritemap plugin for webpack
MIT License
210 stars 51 forks source link

Webpack 5: Error when output.chunk.keep is false #138

Closed jasonevines closed 3 years ago

jasonevines commented 3 years ago

When using Webpack 5, unless I set output.chunk.keep to true, the compilation fails with this error:

` caused by plugins in Compilation.hooks.processAssets TypeError: chunk.files.delete is not a function

System information ` node@e083ef15afbe:/app$ npx envinfo --system --binaries --npmPackages

System: OS: Linux 5.4 Debian GNU/Linux 10 (buster) 10 (buster) CPU: (10) x64 Intel(R) Xeon(R) W-2150B CPU @ 3.00GHz Memory: 25.84 GB / 31.36 GB Container: Yes Shell: 5.0.3 - /bin/bash Binaries: Node: 14.15.1 - /usr/local/bin/node Yarn: 1.22.5 - /usr/local/bin/yarn npm: 6.14.8 - /usr/local/bin/npm npmPackages: @babel/cli: ^7.12.10 => 7.12.10 @babel/core: ^7.12.10 => 7.12.10 @babel/eslint-parser: ^7.12.1 => 7.12.1 @babel/plugin-proposal-class-properties: ^7.12.1 => 7.12.1 @babel/plugin-proposal-private-methods: ^7.12.1 => 7.12.1 @babel/plugin-transform-runtime: ^7.12.10 => 7.12.10 @babel/preset-env: ^7.12.10 => 7.12.10 @babel/runtime-corejs3: ^7.12.5 => 7.12.5 @brightcove/player-loader: ^1.8.0 => 1.8.0 @gfx/zopfli: ^1.0.15 => 1.0.15 @soda/friendly-errors-webpack-plugin: ^1.8.0 => 1.8.0 @types/luxon: ^1.25.0 => 1.25.0 @types/node: ^14.14.13 => 14.14.13 @types/voca: ^1.4.0 => 1.4.0 @typescript-eslint/eslint-plugin: ^4.9.1 => 4.9.1 @typescript-eslint/parser: ^4.9.1 => 4.9.1 algoliasearch: ^4.8.3 => 4.8.3 assets-webpack-plugin: ^7.0.0 => 7.0.0 autoprefixer: ^10.1.0 => 10.1.0 babel-loader: ^8.2.2 => 8.2.2 babel-plugin-source-map-support: ^2.1.3 => 2.1.3 bourbon: ^7.0.0 => 7.0.0 clean-webpack-plugin: ^3.0.0 => 3.0.0 color: ^3.1.3 => 3.1.3 compression-webpack-plugin: ^7.0.0 => 7.0.0 core-js: 3.8.1 => 3.8.1 cross-env: ^7.0.3 => 7.0.3 css-loader: ^5.0.1 => 5.0.1 css-minimizer-webpack-plugin: ^1.1.5 => 1.1.5 dir-loader: ^0.3.0 => 0.3.0 eslint: ^7.15.0 => 7.15.0 eslint-config-airbnb-base: ^14.2.1 => 14.2.1 eslint-config-airbnb-typescript: ^12.0.0 => 12.0.0 eslint-config-prettier: ^7.0.0 => 7.0.0 eslint-import-resolver-typescript: ^2.3.0 => 2.3.0 eslint-import-resolver-webpack: ^0.13.0 => 0.13.0 eslint-loader: ^4.0.2 => 4.0.2 eslint-plugin-import: ^2.22.1 => 2.22.1 eslint-plugin-jsx-a11y: ^6.4.1 => 6.4.1 eslint-plugin-prettier: ^3.2.0 => 3.2.0 eslint-plugin-react: ^7.21.5 => 7.21.5 eslint-plugin-react-hooks: ^4.2.0 => 4.2.0 eslint-webpack-plugin: ^2.4.1 => 2.4.1 exports-loader: ^1.1.1 => 1.1.1 fast-average-color: ^6.3.0 => 6.3.0 fibers: ^5.0.0 => 5.0.0 file-loader: ^6.2.0 => 6.2.0 filesize: ^6.1.0 => 6.1.0 flatpickr: ^4.6.6 => 4.6.6 foundation-sites: ^6.6.3 => 6.6.3 glob: ^7.1.4 => 7.1.6 hoverintent: ^2.2.1 => 2.2.1 html-entities: ^1.3.1 => 1.3.1 image-webpack-loader: ^7.0.1 => 7.0.1 install-peerdeps: ^2.0.3 => 2.0.3 instantsearch.js: ^4.9.1 => 4.9.1 intersection-observer: ^0.12.0 => 0.12.0 jquery: ^3.5.1 => 3.5.1 jump.js: ^1.0.2 => 1.0.2 luxon: ^1.25.0 => 1.25.0 mini-css-extract-plugin: ^1.3.3 => 1.3.3 motion-ui: ^2.0.3 => 2.0.3 path: ^0.12.7 => 0.12.7 postcss: ^8.2.1 => 8.2.1 postcss-loader: ^4.1.0 => 4.1.0 postcss-rem: ^1.1.4 => 1.1.5 prettier: ^2.2.1 => 2.2.1 pretty-error: ^2.1.2 => 2.1.2 route-recognizer: ^0.3.4 => 0.3.4 sass: ^1.30.0 => 1.30.0 sass-loader: ^10.1.0 => 10.1.0 sass-resources-loader: ^2.1.1 => 2.1.1 scrollama: ^2.2.1 => 2.2.1 smartypants: ^0.1.1 => 0.1.1 source-map-support: ^0.5.19 => 0.5.19 sprintf-js: ^1.1.2 => 1.1.2 svg-sprite-loader: ^5.1.1 => 5.1.1 svg-spritemap-webpack-plugin: ^3.8.1 => 3.8.1 swiper: ^6.4.1 => 6.4.1 terser: npm:terser => 5.5.1 terser-webpack-plugin: ^5.0.3 => 5.0.3 ts-loader: ^8.0.12 => 8.0.12 typescript: ^4.1.3 => 4.1.3 typescript-eslint-language-service: ^4.1.2 => 4.1.2 url-loader: ^4.1.1 => 4.1.1 voca: ^1.4.0 => 1.4.0 webpack: ^5.10.1 => 5.10.1 webpack-chunk-hash: ^0.6.0 => 0.6.0 webpack-cli: ^4.2.0 => 4.2.0 webpack-entry-plus: ^1.0.18 => 1.0.18 webpack-fix-style-only-entries: ^0.6.0 => 0.6.0 webpack-log: ^3.0.1 => 3.0.1 webpack-manifest-plugin: ^3.0.0 => 3.0.0 what-input: ^5.2.10 => 5.2.10 `

cascornelissen commented 3 years ago

Looks like this slipped in during a refactor last week, aiming to fix this near the end of this week. Thanks for reporting :v:

cascornelissen commented 3 years ago

Hmm, I can't seem to reproduce this. The stacktrace you've provided errors here in Webpack's Compilation.js, outside of the plugin. It's almost as if either the chunk or the asset is being removed somehow by another part in your setup.

Could you...

  1. Clone this repository and run the simple example by following this README? Does that compile without problems on your side?
  2. Provide a minimal repository that I can use to reproduce the problem?
cascornelissen commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.