oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.48k stars 2.71k forks source link

!!When packaging, the undefined type is compiled into the undefined of the string. #10065

Open aishuaikang opened 5 months ago

aishuaikang commented 5 months ago

What version of Bun is running?

1.1.2+c8d072c2a

What platform is your computer?

Linux 5.15.0-101-generic x86_64 x86_64

What steps can reproduce the bug?

build.ts

await Bun.build({
    entrypoints: ["./src/index.ts"],
    outdir: "./build",
    target: "bun",
    format: "esm",
    sourcemap: "inline",
    minify: true,
});

console.log("Build success!");

export {};

When a strange situation occurs after execution

Query: select `id`, `username`, `email`, `phone`, `role`, `create_time`, `update_time` from (select `id`, `username`, `email`, `phone`, `role`, `create_time`, `update_time` from `users` where (`users`.`username` like ? and `users`.`email` like ? and `users`.`phone` like ? and `users`.`role` like ?)) `userList` limit ? -- params: ["%undefined%", "%undefined%", "%undefined%", "%undefined%", 10]

All my parameters have become undefined.

image

What is the expected behavior?

Query: select `id`, `username`, `email`, `phone`, `role`, `create_time`, `update_time` from (select `id`, `username`, `email`, `phone`, `role`, `create_time`, `update_time` from `users`) `userList` limit ? -- params: [10]

What do you see instead?

No response

Additional information

No response

aishuaikang commented 5 months ago

9994 Reprodicating the code is to remove --minify and execute it after packaging it.

github-actions[bot] commented 1 month ago

This issue is stale and may be closed due to inactivity. If you're still running into this, please leave a comment.