Skip to content

Parse errors from SWC could be better #8529

@bartlomieju

Description

@bartlomieju

Currently if SWC parser encounters error its output is pretty minimal:

import b, { c } from "./b.js";

console.log(b);
console.log(c
error: Unexpected eof at file:///Users/biwanczuk/dev/deno/a.js:4:13

It'd be great if produced error could contain snippet of code pointing to problematic bit of code, similar to errors from TS and V8:

import b, { c } from "./b.js";

foo
console.log(b);
console.log(c);
error: Uncaught ReferenceError: foo is not defined
foo
^
    at file:///Users/biwanczuk/dev/deno/a.js:3:1

CC @kdy1

Metadata

Metadata

Assignees

No one assigned

    Labels

    clirelated to cli/ dirfeatnew feature (which has been agreed to/accepted)swcrelated to swc (bundling/transpiling)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions