svg-spritemap-webpack-plugin: Broken build 3.5.8

On build 3.5.8 getting next error, on 3.5.7 all is OK

SVGSpritemapPlugin(node:3562603) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'startsWith' of undefined
    at /home/mihail-opanasenko/www/project/node_modules/svg-spritemap-webpack-plugin/lib/index.js:291:77
    at Array.forEach (<anonymous>)
    at /home/mihail-opanasenko/www/project/node_modules/svg-spritemap-webpack-plugin/lib/index.js:290:32
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/mihail-opanasenko/www/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:12:1)
    at AsyncSeriesHook.lazyCompileHook (/home/mihail-opanasenko/www/project/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.emitAssets (/home/mihail-opanasenko/www/project/node_modules/webpack/lib/Compiler.js:367:19)
    at onCompiled (/home/mihail-opanasenko/www/project/node_modules/webpack/lib/Compiler.js:235:9)
    at /home/mihail-opanasenko/www/project/node_modules/webpack/lib/Compiler.js:556:14
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/mihail-opanasenko/www/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (/home/mihail-opanasenko/www/project/node_modules/tapable/lib/Hook.js:154:20)
    at /home/mihail-opanasenko/www/project/node_modules/webpack/lib/Compiler.js:553:30
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/mihail-opanasenko/www/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at AsyncSeriesHook.lazyCompileHook (/home/mihail-opanasenko/www/project/node_modules/tapable/lib/Hook.js:154:20)
    at /home/mihail-opanasenko/www/project/node_modules/webpack/lib/Compilation.js:1323:35
    at eval (eval at create (/home/mihail-opanasenko/www/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:17:1)
    at /home/mihail-opanasenko/www/project/node_modules/svg-spritemap-webpack-plugin/lib/index.js:254:32
    at _next0 (eval at create (/home/mihail-opanasenko/www/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
    at eval (eval at create (/home/mihail-opanasenko/www/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:28:1)
    at /home/mihail-opanasenko/www/project/node_modules/svg-spritemap-webpack-plugin/lib/index.js:245:32
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:3562603) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 95)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

@ivankristianto, the fix for this issue has been released in version 3.5.9 🚀 I’m expecting this to also solve the original issue, thanks for helping me debug it!

@cascornelissen I’m very curious about this issue and spent a bit of time to hunt it down. And better, i provide the proof of concept what causing the issue. Here is the repo: https://github.com/ivankristianto/svg-spritemap-webpack-plugin-demo

And if you enable this line: https://github.com/ivankristianto/svg-spritemap-webpack-plugin-demo/blob/master/src/client.js#L5

And do yarn && yarn build, it will throw this error:

95% [0] emitting SVGSpritemapPlugin(node:10529) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'startsWith' of null

my environment:

node: v12.16.2
webpack: v4.44.1
webpack-cli: v3.3.12

And if you try with the version 3.5.7, it can compile successfully.

If there is anything I can help you more, please let me know.

And last but not least, thank you so much for your help and build / maintain this plugin.