bun
bun copied to clipboard
Implement `--keep-names` to prevent mangling function `.name` accesses
What version of Bun is running?
1.1.17+bb66bba1b
What platform is your computer?
Darwin 23.5.0 arm64 arm
What steps can reproduce the bug?
- Create a simple app that accesses a function's name via
.name
. For example:
function testFunction() {}
console.log(`Function name: ${testFunction.name}`);
- Bundle the code with the following options:
const buildConfiguration = {
define: {},
entrypoints: ['./path/to/example/file.mjs'],
external: [],
format: 'esm',
loader: {},
minify: true,
naming: {
chunk: '[name].[hash].mjs',
entry: '[name].mjs',
},
outdir: './dist',
plugins: [],
publicPath: '',
root: '.',
sourcemap: 'external',
splitting: true,
target: 'bun',
}
- Run the code with
bun dist/index.mjs
- See the function's reported name is
n
or something similar rather than the expectedtestFunction
What is the expected behavior?
The function's .name
should be testFunction
What do you see instead?
n
or a similar one character value
Additional information
No response