-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
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
bun build --compile
has different behavior with bun run
#11442
Comments
bun build --compile
has difference behavior with bun run
bun build --compile
has different behavior with bun run
bun build --compile
has different behavior with bun run
bun build --compile
has different behavior with bun run
HELLO, I also encountered the same problem. It took me a long time to find out that it was an issue with bun. Has this problem been resolved? |
There is no garbled text when running, but after building, it becomes garbled. The garbled part in the code is a JSON file.
|
The program has been written and is ready for release, but the issue of garbled text cannot be resolved. I'm really sorry if I'm bothering you. I have nowhere else to find the answer and hope to get your help. 😢 |
@BANG88 this is an encoding issue where we are incorrectly treating JSON as latin1 when it should be utf8, or vice versa to workaround this issue, you could try using a macro import {text} from './text' with {type: "macro"};
const bot = JSON.parse(text("./zh-CN.json")); text.js export function text(path) {
return require("fs").readFileSync(path, "utf-8");
} |
Thank you for replying so quickly. I just created a repro demo. |
I temporarily changed the JSON file to a
😆 🚀 Thank you again. |
What version of Bun is running?
1.1.10
What platform is your computer?
Linux 5.15.0-107-generic x86_64 x86_64
What steps can reproduce the bug?
Create a bun project via
bun init
read an array from a file and print out the elements
index.ts
list.json
build and run the app with
bun build --compile
What is the expected behavior?
the output should be the same as
bun run ./index.ts
What do you see instead?
got garbled characters
Additional information
No response
The text was updated successfully, but these errors were encountered: