Issue with generated sourcemaps via source-loader
See original GitHub issueDescribe the bug
We’ve hit an issue when upgrading our repo to the latest version of @storybook/vue
. After going through the releases it appears the issue is linked to a change in source-loader which looks like it was introduced in v6.1.0-alpha.21.
I’ve pasted the error log below, but essentially it looks like the sourcemap being generated isn’t being converted to JSON properly – when logged via console
, we see a SourceMapGenerator
object, rather than just a JSON object – which is why we are seeing "version" is a required argument
– as that argument doesn’t exist until the sourcemap is parsed properly into JSON.
To Reproduce
I’ve made a branch of our repo which you can checkout to reproduce the issue.
- Checkkout ‘fozzie-components’ repo (package-updates branch)
- Run
yarn
(or NPM) to install packages at the root of the repo. - Run
yarn storybook:build
at the root of the repo to build storybook. - See error.
Note that if you downgrade to alpha.20
in this file, the build successfully completes.
Expected behavior Storybook should build successfully.
Error log:
92% chunk asset optimization TerserPluginERR! => Failed to build the preview e @justeat/storybook: ERR! "version" is a required argument. e @justeat/storybook: (node:6368) UnhandledPromiseRejectionWarning: Error: "version" is a required argument. n @justeat/storybook: at Object.getArg (/_je/ui/components/fozzie-components/node_modules/source-map/lib/util.js:24:11) m @justeat/storybook: at new BasicSourceMapConsumer (/_je/ui/components/fozzie-components/node_modules/source-map/lib/source-map-consumer.js:294:22) d @justeat/storybook: at new SourceMapConsumer (/_je/ui/components/fozzie-components/node_modules/source-map/lib/source-map-consumer.js:22:7) = @justeat/storybook: at SourceMapSource.node (/_je/ui/components/fozzie-components/node_modules/webpack-sources/lib/SourceMapSource.js:32:62)
@justeat/storybook: at ReplaceSource.node (/_je/ui/components/fozzie-components/node_modules/webpack-sources/lib/ReplaceSource.js:82:27)
@justeat/storybook: at CachedSource.node (/_je/ui/components/fozzie-components/node_modules/webpack-sources/lib/CachedSource.js:18:24)
@justeat/storybook: at ReplaceSource.node (/_je/ui/components/fozzie-components/node_modules/webpack-sources/lib/ReplaceSource.js:82:27)
@justeat/storybook: at /_je/ui/components/fozzie-components/node_modules/webpack-sources/lib/ConcatSource.js:59:50
@justeat/storybook: at Array.map (<anonymous>)
@justeat/storybook: at ConcatSource.node (/_je/ui/components/fozzie-components/node_modules/webpack-sources/lib/ConcatSource.js:58:63)
@justeat/storybook: at ConcatSource.proto.sourceAndMap (/_je/ui/components/fozzie-components/node_modules/webpack-sources/lib/SourceAndMapMixin.js:29:18)
@justeat/storybook: at CachedSource.sourceAndMap (/_je/ui/components/fozzie-components/node_modules/webpack-sources/lib/CachedSource.js:58:31)
@justeat/storybook: at TerserPlugin.taskGenerator (/_je/ui/components/fozzie-components/node_modules/@storybook/core/node_modules/terser-webpack-plugin/dist/index.js:198:23)
@justeat/storybook: at taskGenerator.next (<anonymous>)
@justeat/storybook: at /_je/ui/components/fozzie-components/node_modules/@storybook/core/node_modules/terser-webpack-plugin/dist/index.js:455:49
@justeat/storybook: at /_je/ui/components/fozzie-components/node_modules/@storybook/core/node_modules/p-limit/index.js:23:31
@justeat/storybook: (node:6368) 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: 2)
Code snippets If applicable, add code samples to help explain your problem.
System
Environment Info:
System:
OS: macOS Mojave 10.14.6
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Binaries:
Node: 12.19.1 - /usr/local/bin/node
Yarn: 1.19.1 - ~/.npm-packages/bin/yarn
npm: 6.14.8 - ~/.npm-packages/bin/npm
Browsers:
Chrome: 87.0.4280.141
Firefox: 84.0.1
Safari: 14.0.2
npmPackages:
@storybook/storybook-deployer: 2.8.7 => 2.8.7
┆Issue is synchronized with this Asana task by Unito
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
@ankon any thoughts on this? i’m planning to revert the PR for now
ZOMG!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.2.0-beta.14 containing PR #14199 that references this issue. Upgrade today to the
@next
NPM tag to try it out!Closing this issue. Please re-open if you think there’s still more to do.