question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with generated sourcemaps via source-loader

See original GitHub issue

Describe 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.

  1. Checkkout ‘fozzie-components’ repo (package-updates branch)
  2. Run yarn (or NPM) to install packages at the root of the repo.
  3. Run yarn storybook:build at the root of the repo to build storybook.
  4. 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:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
shilmancommented, Mar 4, 2021

@ankon any thoughts on this? i’m planning to revert the PR for now

0reactions
shilmancommented, Mar 11, 2021

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!

npx sb upgrade --prerelease

Closing this issue. Please re-open if you think there’s still more to do.

Read more comments on GitHub >

github_iconTop Results From Across the Web

source-map-loader - webpack
The source-map-loader extracts existing source maps from all JavaScript entries. This includes both inline source maps as well as those linked via URL....
Read more >
4 Reasons Why Your Source Maps are Broken - Sentry Blog
Missing or incorrect source map directive. We're going to presume that you've already produced a source map using a tool like UglifyJS or ......
Read more >
How do source maps work? - Matt Zeunert
Source maps solve this problem. They describe how the compiled code is related to your original source code. The debugger can then show...
Read more >
Using sourcemaps on production without exposing the source ...
There is a good solution for this issue — sourcemaps. It allows you to debug minified code as if it was unmodified.
Read more >
Source Maps Not Generated by WebPack - Stack Overflow
Per the docs, not sure if it will fix your problem, When using the uglifyjs-webpack-plugin you must provide the sourceMap: true option to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found