swc-project / swc-project/plugins
styled-jsx transform infinite loop
Open
@kdy1 is already working on this.
Since Aug 24, 2026.
- Dominant language
- Rust
- Stars
- 389
- Forks
- 106
- Avg merge
- 10m
- Merged PRs (30d)
- 1
Description
Describe the bug
There is an infinite loop when transforming this file with styled-jsx:
Minimal reproduction
Put
export const Probe = (props) => {
const t = props.theme;
const Icon = t.icon;
return (
<div className="probe">
<Icon />
<style jsx>{`
.probe {
color: ${t.color};
}
`}</style>
</div>
);
};
into packages/styled-jsx/transform/tests/fixture/class/input.js
Then you get
> Should transform class correctly
Error: Test timed out in 5000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
Snapshots 1 obsolete
↳ __tests__/wasm.test.ts
· Should transform class correctly 1
Test Files 1 failed (1)
Tests 1 failed | 2 passed | 78 skipped (81)
Start at 21:57:39
Duration 5.43s (transform 23ms, setup 0ms, collect 44ms, tests 5.23s, environment 0ms, prepare 35ms)
This is on commit a93bcc04a4bb2ff676865958db92d85fffd9823a
Expected behavior
It should be transformed and not timeout
Additional context
https://github.com/vercel/next.js/issues/97685
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.