lucacasonato / esbuild_deno_loader

Deno module resolution for `esbuild`
https://deno.land/x/esbuild_deno_loader
MIT License
160 stars 43 forks source link

Module parse failure make the file unwatchable #91

Open jeiea opened 10 months ago

jeiea commented 10 months ago

Steps to reproduce

  1. Prepare the following files.
    // a.ts
    import "./b.ts";
    // b.ts
    export {};
  2. Run esbuild a.ts in watch mode with esbuild_deno_loader.
  3. Append ,, to b.ts and save.
  4. Remove ,, from b.ts and save.

Expected behavior

Error is recovered and it should be built.

Actual behavior

Some error like the following and nothing happens.

[ERROR] The module's source code could not be parsed: Unexpected token `,`. Expected identifier, string literal, numeric literal or [ for the computed key at

If we modify a.ts, it works fine again.

Additional context

https://github.com/jeiea/esbuild_deno_loader this works as expected, but it feels like monkey patching.

I think it should fail on load phase, not resolve phase.