-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
NodeJS Core Dump on Specific Syntax Error (Prop::Assign) #5379
Description
Rollup Version
4.9.6
Operating System (or Browser)
Ubuntu Linux
Node Version (if applicable)
v21.2.0
Link To Reproduction
This repo contains a minimal reproduction for a Node environment:
https://github.com/curran/rollup-swc-crash-reproduction
The REPL reproduction fails to produce the exact same behavior that this issue is about, but may be of interest nevertheless to see how this error plays out in the WASM build:
Here's another repro in the SWC Playground:
Expected Behaviour
When invoking Rollup in Node via the JS API with a source file that contains the following kind of syntax error:
const foo = {
bar = baz,
};
console.log(foo);the call to this line:
const bundle = await rollup(inputOptions);should throw an error explaining that there is a syntax error.
Actual Behaviour
Rollup surprisingly does not throw the error, but rather seems to cause the entire Node process to crash (which ended up crashing my Web app server that invokes Rollup). This is the error that gets logged to the terminal:
thread '<unnamed>' panicked at parse_ast/src/convert_ast/converter.rs:848:26:
not implemented: Cannot convert Prop::Assign
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
Aborted (core dumped)
Has anyone encountered this before? Anyone know of a way to prevent the process from crashing? Perhaps there's an option like handleSWCError or something? I wrapped the invication of Rollup in a try/catch, but this error is mysteriously never caught. Perhaps this is an upstream bug in SWC? Many thanks!