Open LiamDotPro opened 3 years ago
@farnabaz Is there a chance you could look into this? I looked for alternatives to this package but nothing really comes close and hacking vue-svgicon
to work feels like a dirty solution.
@LiamDotPro Sorry for the late response, could you create a reproduction sample?
From the error, it seems that this isn't related to nuxt-ts.
I'm getting an issue like this.
(node:79309) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'split' of undefined
at fromStringWithSourceMap (/home/derevandal/projects/github.com/derevandal/nuxt-svg-sprite-storybook-example/node_modules/source-list-map/lib/fromStringWithSourceMap.js:15:32)
at SourceMapSource.listMap (/home/derevandal/projects/github.com/derevandal/nuxt-svg-sprite-storybook-example/node_modules/webpack-sources/lib/SourceMapSource.js:45:10)
at ReplaceSource.listMap (/home/derevandal/projects/github.com/derevandal/nuxt-svg-sprite-storybook-example/node_modules/webpack-sources/lib/ReplaceSource.js:140:26)
at CachedSource.listMap (/home/derevandal/projects/github.com/derevandal/nuxt-svg-sprite-storybook-example/node_modules/webpack-sources/lib/CachedSource.js:22:24)
at ConcatSource.listMap (/home/derevandal/projects/github.com/derevandal/nuxt-svg-sprite-storybook-example/node_modules/webpack-sources/lib/ConcatSource.js:72:18)
at ConcatSource.proto.sourceAndMap (/home/derevandal/projects/github.com/derevandal/nuxt-svg-sprite-storybook-example/node_modules/webpack-sources/lib/SourceAndMapMixin.js:24:16)
at CachedSource.sourceAndMap (/home/derevandal/projects/github.com/derevandal/nuxt-svg-sprite-storybook-example/node_modules/webpack-sources/lib/CachedSource.js:58:31)
at getTaskForFile (/home/derevandal/projects/github.com/derevandal/nuxt-svg-sprite-storybook-example/node_modules/webpack/lib/SourceMapDevToolPlugin.js:65:30)
at /home/derevandal/projects/github.com/derevandal/nuxt-svg-sprite-storybook-example/node_modules/webpack/lib/SourceMapDevToolPlugin.js:215:20
at Array.forEach (<anonymous>)
at /home/derevandal/projects/github.com/derevandal/nuxt-svg-sprite-storybook-example/node_modules/webpack/lib/SourceMapDevToolPlugin.js:186:12
at SyncHook.eval (eval at create (/home/derevandal/projects/github.com/derevandal/nuxt-svg-sprite-storybook-example/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:14:1)
at SyncHook.lazyCompileHook (/home/derevandal/projects/github.com/derevandal/nuxt-svg-sprite-storybook-example/node_modules/tapable/lib/Hook.js:154:20)
at /home/derevandal/projects/github.com/derevandal/nuxt-svg-sprite-storybook-example/node_modules/webpack/lib/Compilation.js:1413:42
at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/derevandal/projects/github.com/derevandal/nuxt-svg-sprite-storybook-example/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1)
at AsyncSeriesHook.lazyCompileHook (/home/derevandal/projects/github.com/derevandal/nuxt-svg-sprite-storybook-example/node_modules/tapable/lib/Hook.js:154:20)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:79309) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:79309) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
This example repo is available here: https://github.com/derevandal/nuxt-svg-sprite-storybook-example and https://codesandbox.io/s/nervous-cartwright-t1ng7
I'm getting this error when I ran yarn dev:build
(a shortcut for nuxt-ts storybook
).
Could you help me @farnabaz ?
Thx <3
@derevandal Sorry for the late response . Your issue is related to nuxt/storybook and should fix with the latest release v3.3.1.
@farnabaz np, man! it works! thank you
FATAL Cannot read property 'hasAttr' of null 12:40:04
at _findById (node_modules/@nuxtjs/svg-sprite/lib/plugins/inlineDefs.js:200:15) at Proxy.exports.fn (node_modules/@nuxtjs/svg-sprite/lib/plugins/inlineDefs.js:60:15) at node_modules/svgo/lib/svgo/plugins.js:95:27 at Array.forEach ()
at full (node_modules/svgo/lib/svgo/plugins.js:93:13)
at node_modules/svgo/lib/svgo/plugins.js:25:24
at Array.forEach ()
at module.exports (node_modules/svgo/lib/svgo/plugins.js:15:13)
at node_modules/svgo/lib/svgo.js:70:17
at SAXParser.sax.onend (node_modules/svgo/lib/svgo/svg2js.js:169:13)
at emit (node_modules/sax/lib/sax.js:624:35)
at end (node_modules/sax/lib/sax.js:667:5)
at SAXParser.write (node_modules/sax/lib/sax.js:975:14)
at SAXParser.close (node_modules/sax/lib/sax.js:157:38)
at module.exports (node_modules/svgo/lib/svgo/svg2js.js:182:28)
at SVGO._optimizeOnce (node_modules/svgo/lib/svgo.js:64:5)
╭───────────────────────────────────────────────────────╮ │ │ │ ✖ Nuxt Fatal Error │ │ │ │ TypeError: Cannot read property 'hasAttr' of null │ │ │ ╰───────────────────────────────────────────────────────╯
Seems to work on the demo and I replicated the same setup inside our project with the same error, removing the plugin removes the errors.