-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
i: regressionoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: generator
Description
💻
- Would you like to work on a fix?
How are you using Babel?
Programmatic API (babel.transform, babel.parse)
Input code
import { transform } from "@babel/core";
transform(`
export const App = () => {
return (
/**
* First
*/
2
);
};
/**
* Second
*/
`, {
retainLines: true,
})Configuration file name
No response
Configuration
No response
Current and expected behavior
Current: crash with RangeError: Invalid count value: -2
Expected: No crash
Environment
v7.23.5
Possible solution
No response
Additional context
After some debugging, commenting this line remove the error:
babel/packages/babel-generator/src/printer.ts
Line 612 in cce807f
| this.dedent(); |
Maybe this need an indent() few lines above?
The pretty stacktrace when running inside Vite:

Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
i: regressionoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: generator