Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Regression parsing of string source maps #45

Open
mschimk1 opened this issue Jul 3, 2024 · 0 comments
Open

[Bug] Regression parsing of string source maps #45

mschimk1 opened this issue Jul 3, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@mschimk1
Copy link

mschimk1 commented Jul 3, 2024

Describe the bug

A regression in v1.0.4 when loading source maps of type string in webpack5 instanbul loader

Steps to reproduce the behavior

Build storybook stories with webpack5 configuration. E.g.,

storybook build --webpack-stats-json

@storybook/cli v7.6.19

info => Cleaning outputDir: /storybook-static
info => Loading presets
info => Building manager..
info => Manager built (1.92 s)
info => Building preview..
info => Copying static files:
...
info Using SWC compiler
info Addon-docs: using MDX2
info => Using implicit CSS loaders
...
info => Using default Webpack5 setup

The build fails with errors similar to the one below:

Module build failed (from ../../node_modules/.pnpm/@storybook[email protected]/node_modules/@storybook/addon-coverage/dist/cjs/loader/webpack5-istanbul-loader.js):
Error: .inputSourceMap must be a boolean, object, or undefined
at transformSync (/node_modules/.pnpm/@babel[email protected]/node_modules/@babel/core/lib/transform.js:42:76)
at Instrumenter.instrumentSync (/node_modules/.pnpm/[email protected]/node_modules/istanbul-lib-instrument/src/instrumenter.js:102:25)
at Object._default (/node_modules/.pnpm/@storybook[email protected]/node_modules/@storybook/addon-coverage/dist/cjs/loader/webpack5-istanbul-loader.js:36:29)

Expected behavior

The string type source map should be parsed into an object which is then fed into the code instrumentation.

Please view the patch I have contributed #44.

Screenshots and/or logs

Please refer to sample error above

Environment

  • OS: MacOS Sonoma v14.5
  • Node.js version: v20.12.2
  • NPM version: pnpm 9.4.0
  • Browser (if applicable): N/A
  • Browser version (if applicable): N/A
  • Device (if applicable): N/A

Additional context

A very similar issue was previously reported here #32, and fixed in #33.

However, it was reintroduced as part of Fix sourcemap generation for Webpack5 projects.

@mschimk1 mschimk1 added the bug Something isn't working label Jul 3, 2024
@mschimk1 mschimk1 changed the title [Bug] [Bug] Regression parsing of string source maps Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant