cascornelissen / svg-spritemap-webpack-plugin

SVG spritemap plugin for webpack
MIT License
207 stars 50 forks source link

Error when using with webpack-manifest-plugin #131

Closed OlehDutchenko closed 3 years ago

OlehDutchenko commented 3 years ago

I using webpack 5. My config:

/* ... */
plugins: [
    new CleanWebpackPlugin(),
    new MiniCssExtractPlugin({
        filename: '[name].bundle.css'
    }),
    new SVGSpriteMapPlugin('resources/assets/svg/docs/*.svg'),
    new ManifestPlugin({
        basePath: paths.public.base
    })
],
/* ... */

And faced with error

× 「wdm」: TypeError: chunk.files.reduce is not a function
    at ManifestPlugin.<anonymous> (C:\OSPanel\domains\petr.loc\node_
modules\webpack-manifest-plugin\lib\plugin.js:95:26)
    at Array.reduce (<anonymous>)
    at Set.set.<computed> [as reduce] (C:\OSPanel\domains\petr.loc\n
ode_modules\webpack\lib\util\deprecation.js:87:35)
    at ManifestPlugin.<anonymous> (C:\OSPanel\domains\petr.loc\node_
modules\webpack-manifest-plugin\lib\plugin.js:94:36)
    at Hook.eval [as callAsync] (eval at create (C:\OSPanel\domains\
petr.loc\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonym
ous>:27:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (C:\OSPanel\domains\
petr.loc\node_modules\tapable\lib\Hook.js:18:14)
    at Compiler.emitAssets (C:\OSPanel\domains\petr.loc\node_modules
\webpack\lib\Compiler.js:763:19)
    at C:\OSPanel\domains\petr.loc\node_modules\webpack\lib\Watching
.js:80:21
    at processTicksAndRejections (internal/process/task_queues.js:76
:11)

What I'm doing wrong or it's ManifestPlugin prodlem. Without ManifestPlugin all works fine...

cascornelissen commented 3 years ago

Which version of webpack-manifest-plugin are you using?

OlehDutchenko commented 3 years ago

next (^3.0.0-rc.0) specialy for webpack 5

cascornelissen commented 3 years ago

Hmm, it definitely looks like an issue with manifest-webpack-plugin, the stack trace you provided points to a TypeError in that plugin where it looks like to be going wrong for a chunk without any files (either created by this plugin or not) which is a valid scenario in Webpack AFAIK.

Please report the issue on that repository. If it ends up needing a fix in this plugin (once a stable release of manifest-webpack-plugin comes out) then feel free to leave another comment and I'll reopen it and will investigate. If that happens, please include a repo that I can use to reproduce the error.