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 think this was a breaking change since the error is emitted as a string, which is unexpected and slightly unconvinient. The expectation was to keep emitting an js object error.
The main issue is that:
json parsing adds some overhead and it has to be done ALWAYS since string is not useful
makes error handling weird/inconsistent since swc wasm crashes are also strings so we try to json.parse and it fails while right now if its a string we know its a wasm crash
Input code
constinputCode="module F { export type x = number }";try{transformSync(inputCode,{mode: "transform",});}catch(error){console.log("TYPEOF OF ERROR",typeoferror);assert.strictEqual(error.code,"UnsupportedSyntax");}TYPEOFOFERRORstring
Config
Playground link (or link to the minimal reproduction)
Describe the bug
I think this was a breaking change since the error is emitted as a string, which is unexpected and slightly unconvinient. The expectation was to keep emitting an js object error.
The main issue is that:
Input code
Config
Playground link (or link to the minimal reproduction)
https://play.swc.rs/?version=1.11.7&code=H4sIAAAAAAAAA8vNTynNSVVwU6hWSK0oyC8qUSipLEhVqFCwVcgrzU1KLVKoBQBGDE3yIwAAAA%3D%3D&config=H4sIAAAAAAAAA1WPSw7DIAwF9zkF8rrbdtE79BAWdSIifrKJVBTl7iUE0maH3xsz8jooBbNoeKq1PMsQkYX4nEsi2Sf8lARIOxTNJia49XaWvRrRCtVoOxpIyBOluiX3hoMNQajjLXPGmzH%2FC3VwkUnkCu4o%2BsnSVTc0JbjwXmrZDkk50qF%2FwA%2FqsvNjMPLqm4kXGrYvhlQioBQBAAA%3D&strip-types=
SWC Info output
No response
Expected behavior
Emit an object
Actual behavior
Emits a string
Version
1.11.7
Additional context
No response
The text was updated successfully, but these errors were encountered: