We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.1.40+b5b51004e
Darwin 24.2.0 arm64 arm
given I have an input sample.mjs:
export const __filename = new URL(import.meta.url).pathname; export const __dirname = __filename.split('/').slice(0, -1).join('/'); console.log({ __dirname, __filename });
run bun build sample.mjs
bun build sample.mjs
the output should not be touched and look like following which esbuild does esbuild sample.mjs gives correct result:
esbuild sample.mjs
"use strict"; export const __filename = new URL(import.meta.url).pathname; export const __dirname = __filename.split("/").slice(0, -1).join("/"); console.log({ __dirname, __filename });
// sample.mjs var __filename2 = new URL(import.meta.url).pathname; var __dirname2 = __filename2.split("/").slice(0, -1).join("/"); console.log({ __dirname: __dirname2, __filename: __filename2 }); export { __filename2 as __filename, __dirname2 as __dirname };
const should never be transformed to var in esm as it has different behaviors
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What version of Bun is running?
1.1.40+b5b51004e
What platform is your computer?
Darwin 24.2.0 arm64 arm
What steps can reproduce the bug?
given I have an input sample.mjs:
run
bun build sample.mjs
What is the expected behavior?
the output should not be touched and look like following which esbuild does
esbuild sample.mjs
gives correct result:What do you see instead?
Additional information
const should never be transformed to var in esm as it has different behaviors
The text was updated successfully, but these errors were encountered: