bun
bun copied to clipboard
--minify breaks source maps for Node
What version of Bun is running?
1.1.2+c8d072c2a
What platform is your computer?
Linux 6.6.16-linuxkit aarch64 unknown
What steps can reproduce the bug?
Bundle a file which calls a method with console.trace() from imported module with bun build --sourcemap=inline --target=node --outfile ./bundle.mjs --minify ./index.js and then run it with node --enable-source-maps bundle.mjs.
- index.js
/**
* Comment line 1
* Comment line 2
* Comment line 3
*/
const error = require('./error.js');
error.trace();
- error.js
/**
* Error generater
*/
module.exports = {
/**
* Throws error
*/
error() {
throw new Error();
},
/**
* Prints stack trace
*/
trace() {
console.trace('trace');
},
}
What is the expected behavior?
Stack trace includes correct line number for trace() call: at Object.trace (/usr/src/app/error.js:15:11).
What do you see instead?
Stack trace includes incorrect line number for trace() call: at <anonymous> (/usr/src/app/error.js:4:8).
Additional information
Bundling works fine without --minify.
Bun doesn't support its own source maps.
Duplicate of #7427