bun icon indicating copy to clipboard operation
bun copied to clipboard

json imports bypass transpiler ascii transformation

Open cvng opened this issue 6 months ago • 0 comments

What version of Bun is running?

1.1.25-canary.3+1bac09488

What platform is your computer?

Darwin 23.6.0 arm64 arm

What steps can reproduce the bug?

➜ cat test.json 
{
  "aaa": "€"
}

➜ cat test.js
import { aaa } from './test.json';

console.log('€');
console.log(aaa);

➜ bun build --target=bun test.js
// @bun
// test.json
var aaa = "€";

// test.js
console.log("\u20AC");
console.log(aaa);

What is the expected behavior?

➜ bun build --target=bun test.js
// @bun
// test.json
var aaa = "\u20AC";

// test.js
console.log("\u20AC");
console.log(aaa);

What do you see instead?

➜ bun build --target=bun test.js
// @bun
// test.json
var aaa = "€";

// test.js
console.log("\u20AC");
console.log(aaa);

Additional information

reproduced by @evanwashere

cvng avatar Aug 24 '24 22:08 cvng