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

SWC panicks when processing nested styled-jsx tags #65066

Open
sjchmiela opened this issue Apr 25, 2024 · 1 comment · May be fixed by vercel/turbo#8097
Open

SWC panicks when processing nested styled-jsx tags #65066

sjchmiela opened this issue Apr 25, 2024 · 1 comment · May be fixed by vercel/turbo#8097
Assignees
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team. Runtime Related to Node.js or Edge Runtime with Next.js. SWC Related to minification/transpilation in Next.js.

Comments

@sjchmiela
Copy link

sjchmiela commented Apr 25, 2024

Link to the code that reproduces this issue

https://github.com/sjchmiela/swc-unwrap-panic

To Reproduce

  1. Start the application in development.
  2. Open main page.
  3. Observe Build Error 500 page being rendered and the following error being logged in console:
thread '' panicked at /Users/geist/.cargo/registry/src/index.crates.io-6f17d22bba15001f/styled_jsx-0.73.13/src/visitor.rs:597:44:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Current vs. Expected behavior

Instead of throwing a build error I expected the builder to throw the "Nested styled-jsx tags detected" error. When SWC is disabled and Babel is transpiling code, this, more readable, error is thrown.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 22.6.0: Wed Jul  5 22:22:52 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T8103
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 18.19.0
  npm: 10.2.3
  Yarn: 1.22.21
  pnpm: 9.0.1
Relevant Packages:
  next: 14.3.0-canary.23 // Latest available version is detected (14.3.0-canary.23).
  eslint-config-next: N/A
  react: 18.3.0
  react-dom: 18.3.0
  typescript: 5.1.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Runtime, SWC

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local)

Additional context

No response

NEXT-3241

@sjchmiela sjchmiela added the bug Issue was opened via the bug report template. label Apr 25, 2024
@github-actions github-actions bot added Runtime Related to Node.js or Edge Runtime with Next.js. SWC Related to minification/transpilation in Next.js. labels Apr 25, 2024
@samcx samcx added the linear: next Confirmed issue that is tracked by the Next.js team. label Apr 26, 2024
@kdy1
Copy link
Member

kdy1 commented Apr 29, 2024

swc-project/plugins#294 should fix it. I'll close this issue with a dependency update PR

@kdy1 kdy1 linked a pull request May 7, 2024 that will close this issue
@kdy1 kdy1 self-assigned this May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team. Runtime Related to Node.js or Edge Runtime with Next.js. SWC Related to minification/transpilation in Next.js.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants