index.ts:
function main() {
// Some whitespace for swc to optimize away...
console.log('hello world');
throw new Error('foo');
}
main()
@swc-node/register gives us sourcemap support:
$ node -r @swc-node/register ./index.ts
hello world
/Users/jwalton/t/index.ts:4
throw new Error('foo');
^
Error: foo
at main (/Users/jwalton/t/index.ts:7:11)
But @swc-node/register/esm does not:
node --loader @swc-node/register/esm ./index.ts
(node:81567) ExperimentalWarning: Custom ESM Loaders is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
hello world
file:///Users/jwalton/t/index.ts.mjs:3
throw new Error('foo');
^
Error: foo
at main (file:///Users/jwalton/t/index.ts.mjs:3:11)
index.ts:
@swc-node/register gives us sourcemap support:
$ node -r @swc-node/register ./index.ts hello world /Users/jwalton/t/index.ts:4 throw new Error('foo'); ^ Error: foo at main (/Users/jwalton/t/index.ts:7:11)But @swc-node/register/esm does not: