You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm encountering a bug on ^4.2.0 where if I'm using a block comment in JSX and have an additional block comment somewhere below it in the code babel blows up with the error "repeat count must be non-negative".
Minimal repro seems to be:
exportconstApp=()=>{return(/* This comment */<div>{'Hello world'}</div>);};/** * Plus this comment */functionsomeFunc(){// ...}
I assume the culprit is some upstream babel dependency but I'm unsure exactly where to report it.
11:10:25 [vite] Internal server error: /home/projects/vitejs-vite-fjadpp/src/App.tsx: repeat count must be non-negative
Plugin: vite:react-babel
File: /home/projects/vitejs-vite-fjadpp/src/App.tsx
This is a bug in Babel when using retainLines that was added recently to fix JSX source locations.
Thanks for making a small reproduction, I've reported it here: babel/babel#16165
To work around you can:
Patch @babel/code to not repeat 0 times if ident < 0
Patch this plugin and disable the use of retainLines
Try out the SWC plugin if you don't depend on something specific to Babel
Avoid multi lines comments inside parentheses (maybe?, not exactly sure what triggers it)
Describe the bug
I'm encountering a bug on ^4.2.0 where if I'm using a block comment in JSX and have an additional block comment somewhere below it in the code babel blows up with the error "repeat count must be non-negative".
Minimal repro seems to be:
I assume the culprit is some upstream babel dependency but I'm unsure exactly where to report it.
Reproduction
https://stackblitz.com/edit/vitejs-vite-fjadpp?file=index.html,src%2FApp.tsx,src%2Fmain.tsx&terminal=dev
Steps to reproduce
Open the link and try running the app, error should appear in the console.
System Info
Used Package Manager
npm
Logs
Validations
The text was updated successfully, but these errors were encountered: