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

Can't build S2 with Storybook, Webpack, and Babel #7721

Open
loganzartman opened this issue Feb 4, 2025 · 0 comments
Open

Can't build S2 with Storybook, Webpack, and Babel #7721

loganzartman opened this issue Feb 4, 2025 · 0 comments

Comments

@loganzartman
Copy link

Provide a general summary of the issue here

I'm having trouble building Storybook with the S2 style macro. Specifically, I'm having issues when using @storybook/addon-webpack5-compiler-babel, but NOT with @storybook/addon-webpack5-compiler-swc. When running storybook dev, I get an error like this:

[webpack-dev-middleware] wait until bundle finished
ERROR in ./stories/S2Test.jsx
Module build failed (from ./node_modules/.pnpm/babel-loader@9.2.1_@babel+core@7.26.7_webpack@5.97.1_@swc+core@1.10.14_@swc+helpers@0.5.15__esbuild@0.24.2_/node_modules/babel-loader/lib/index.js):
Error: .inputSourceMap must be a boolean, object, or undefined
    at Object.loadPartialConfigAsync (/Users/logan/storybook-react-webpack-s2/node_modules/.pnpm/@babel+core@7.26.7/node_modules/@babel/core/src/config/index.ts:45:61)
    at Object.loader (/Users/logan/storybook-react-webpack-s2/node_modules/.pnpm/babel-loader@9.2.1_@babel+core@7.26.7_webpack@5.97.1_@swc+core@1.10.14_@swc+helpers@0.5.15__esbuild@0.24.2_/node_modules/babel-loader/lib/index.js:116:30)
    at Object.<anonymous> (/Users/logan/storybook-react-webpack-s2/node_modules/.pnpm/babel-loader@9.2.1_@babel+core@7.26.7_webpack@5.97.1_@swc+core@1.10.14_@swc+helpers@0.5.15__esbuild@0.24.2_/node_modules/babel-loader/lib/index.js:39:12)
 @ ./stories/S2Test.stories.js 1:0-34 4:13-19
 @ ./stories/ lazy ^\.\/.*$ include: (?%21.*node_modules)(?:\/stories(?:\/(?%21\.)(?:(?:(?%21(?:^%7C\/)\.).)*?)\/%7C\/%7C$)(?%21\.)(?=.)[^/]*?\.stories\.(js%7Cjsx%7Cmjs%7Cts%7Ctsx))$ chunkName: [request] namespace object ./S2Test.stories.js ./S2Test.stories
 @ ./storybook-stories.js 23:11-27:5
 @ ./storybook-config-entry.js 6:0-50 17:31-39 24:2-27:4 24:58-27:3 26:31-39

preview compiled with 1 error
=> Failed to build the preview

I think this is related to unplugin-parcel-macros, because without it I don't get this error (but I can't use the style macro).

I created a minimal repro here: https://github.com/loganzartman/storybook-react-webpack-s2
and the minimal diff to break it is here: loganzartman/storybook-react-webpack-s2@82b1e13

I stepped into the debugger a bit, and I see that inputSourceMap seems to contain a JSON string instead of a JS object:

Image

🤔 Expected Behavior?

Successful Storybook build of code with S2 style macro, when using Webpack + Babel

😯 Current Behavior

Error containing .inputSourceMap must be a boolean, object, or undefined

💁 Possible Solution

No response

🔦 Context

No response

🖥️ Steps to Reproduce

  1. git clone https://github.com/loganzartman/storybook-react-webpack-s2
  2. pnpm i
  3. pnpm storybook

Version

@react-spectrum/s2@0.6.0

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

Mac OS

🧢 Your Company/Team

Adobe/Home

🕷 Tracking Issue

No response

@github-project-automation github-project-automation bot moved this to 🩺 To Triage in RSP Component Milestones Feb 5, 2025
@matthewdeutsch matthewdeutsch moved this from 🩺 To Triage to 🔬 To Investigate / Verify in RSP Component Milestones Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🔬 To Investigate / Verify
Development

No branches or pull requests

1 participant