Skip to content

NodeJS Core Dump on Specific Syntax Error (Prop::Assign) #5379

@curran

Description

@curran

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:

https://rollupjs.org/repl/?version=4.9.6&shareable=JTdCJTIyZXhhbXBsZSUyMiUzQW51bGwlMkMlMjJtb2R1bGVzJTIyJTNBJTVCJTdCJTIyY29kZSUyMiUzQSUyMmNvbnN0JTIwZm9vJTIwJTNEJTIwJTdCJTVDbiUyMCUyMGJhciUyMCUzRCUyMGJheiUyQyU1Q24lN0QlM0IlNUNuY29uc29sZS5sb2coZm9vKSUzQiUyMiUyQyUyMmlzRW50cnklMjIlM0F0cnVlJTJDJTIybmFtZSUyMiUzQSUyMm1haW4uanMlMjIlN0QlNUQlMkMlMjJvcHRpb25zJTIyJTNBJTdCJTIyb3V0cHV0JTIyJTNBJTdCJTIyZm9ybWF0JTIyJTNBJTIyZXMlMjIlN0QlMkMlMjJ0cmVlc2hha2UlMjIlM0F0cnVlJTdEJTdE

Here's another repro in the SWC Playground:

https://play.swc.rs/?version=1.3.100&code=H4sIAAAAAAAAA0vOzysuUUjLz1ewVajmUlBISiwCspISq3S4aq25koGy%2BTmpejn56RpANZrWABhzMhQvAAAA&config=H4sIAAAAAAAAA1WPSQ7CMAxF9z1F5DVbWHCHHsIKbpUqk%2BJUIqp6d9JMwM7%2Bg598TELAxhKe4shjXjwGpjD2rHCyEd9ZAZIGWQblI9y6u%2FFlxbBTUc5qQMSwUiwlvrc0aOeYsragZmqaUVYt6ZcnnfGBmP%2BDVxTtqke%2F4qaGBONeezHbHzF5qvgHfEMdNg6D4rk3yxPnB%2BvJL0oTAQAA

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!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions