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
> echo "export type Foo = number" > b.ts
> swc-darwin-x64 compile --source-file-name b.ts --config-file swcrc.json --source-maps true --out-file b.js b.ts
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sourcemap-6.2.3/src/types.rs:655:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Empty fails without any swcrc:
> echo '' > d.ts
> ./swc-darwin-x64 compile --source-file-name d.ts --source-maps true --out-file d.js d.ts
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sourcemap-6.2.3/src/types.rs:655:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Describe the bug
A panic occurs when generating source-maps for an empty or types-only file. Seems to only happen with the binary and not the npm cli.
See the line it crashes on. Note the version of sourcemap is not the latest.
Type-only fails with commonjs modules and sourcemaps enabled:
swcrc.json:
Empty fails without any swcrc:
Input code
Config
Playground link
No response
Expected behavior
Output an empty file + sourcemap
Actual behavior
No response
Version
SWC 0.91.63 (from v1.3.77)
Additional context
No response
The text was updated successfully, but these errors were encountered: