Panic message
backend/src/models/appModels/ABTest.ts (482:0) [COMMONJS_VARIABLE_IN_ESM] Warning: The CommonJS `module` variable is treated as a global variable in an ECMAScript module and may not work as expected
╭─[ src/models/appModels/ABTest.ts:482:1 ]
│
481 │ export default exportedModel;
│ ───┬──
│ ╰──── This file is considered to be an ECMAScript module because of the `export` keyword here:
482 │ module.exports = exportedModel;
│ ───┬──
│ ╰────
─────╯
Rolldown panicked. This is a bug in Rolldown, not your code.
thread 'tokio-runtime-worker' (58) panicked at crates/rolldown_error/src/utils/is_context_too_long.rs:20:5:
internal error: entered unreachable code: Internal error: Diagnostic span is out of range. This should never happen! Span: 7505..7511, Rope length: 7504 bytes, Source ID: DiagnosticFileId("src/controllers/appControllers/customerChatController.ts"), Label message: Some("This file is considered to be an ECMAScript module because of the `export` keyword here:"). Please report this bug with the source file that triggered this error.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error: Panic in async function
Reproduction
This panic occurs when Rolldown attempts to generate a [COMMONJS_VARIABLE_IN_ESM] warning snippet.
To reproduce:
- Create a TypeScript file.
- At the end of the file, mix both ESM and CommonJS exports like this:
export default exportedModel;
module.exports = exportedModel;
- Run this file through the bundler. The panic triggers when Rolldown tries to highlight the lines for the console warning. The log indicates it miscalculates the file length: Span: 7505..7511, Rope length: 7504 bytes.
System Info
This panic was encountered in the cloud during a standard Vercel Deployment (Node.js environment). Vercel's internal Node.js bundler is utilizing Rolldown under the hood.
I do not have the specific Vercel `envinfo`, but it can be reproduced by linking a project and runn
Additional context
The crash specifically happens inside is_context_too_long.rs at line 20:5. It appears the diagnostic tool is miscalculating the string length/character span when trying to draw the visual warning block in the terminal for the export keyword.
Panic message
Reproduction
This panic occurs when Rolldown attempts to generate a
[COMMONJS_VARIABLE_IN_ESM]warning snippet.To reproduce:
System Info
Additional context
The crash specifically happens inside
is_context_too_long.rsat line 20:5. It appears the diagnostic tool is miscalculating the string length/character span when trying to draw the visual warning block in the terminal for theexportkeyword.