Skip to content

= after closing JSX tag breaks parser #10692

@mischnic

Description

@mischnic

Describe the bug

The input below, particularly the </span>=, breaks the parser

works fine in Babel

Input code

function Test() { return ( <Y elements={[ <> <span>x</span>= <br/> </>, true ]} /> ); }

Config

{ "jsc": { "parser": { "syntax": "ecmascript", "jsx": true }, "target": "es2024", "loose": false, "minify": { "compress": false, "mangle": false } }, "module": { "type": "es6" }, "minify": false, "isModule": true }

Link to the code that reproduces this issue

https://play.swc.rs/?version=1.12.6&code=H4sIAAAAAAAAA0srzUsuyczPUwhJLS7R0FSo5lJQKEotKS3KU9AAMhUUbCLBFAik5qTmpuaVFNtWR8PFbOzgTDC3uCAxz67CRh9M26LKJRXpI1Tb6NvpwDklRaWpcE5sLZgJVqtpzVXLBQBcwA0lpAAAAA%3D%3D&config=H4sIAAAAAAAAA1WPSw7DIAxE9zkF8rqLKqq66B16CIs6ERE%2FYSIVRbl7CQHa7vCbGcbeBiFgYQkPseVnHjwGptDnTDjZiO9MgKRBlkH5CJemLnxIMaxUyH4KEDHMFEuIx%2Bt4qwHQzjFlPKFmqswoq6b0Wymd8YGY%2F42HFe2se%2F5sHGorGPdai1hPicnTucEdvqZW1j8Gxc%2BWLHfsH%2BoMFmcWAQAA

SWC Info output

No response

Expected behavior

Works

Actual behavior

 x Expression expected ,-[input.jsx:6:1] 3 | <Y 4 | elements={[ 5 | <> 6 | <span>x</span>= : ^^ 7 | <br/> 8 | </>, 9 | true `---- x Unterminated regexp literal ,-[input.jsx:8:1] 5 | <> 6 | <span>x</span>= 7 | <br/> 8 | </>, : ^^^ 9 | true 10 | ]} 11 | /> `---- Caused by: 0: failed to process js file 1: Syntax Error 

Version

1.12.6

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions