Skip to content

Commit f2c905a

Browse files
pass node env to bun build
1 parent 9017aa8 commit f2c905a

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

scripts/bun/build.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ const publicPath = process.env.ASSET_PUBLIC_PATH || "/assets/dist/";
6464
const isProd =
6565
process.env.NODE_ENV === "production" ||
6666
process.env.RAILS_ENV === "production";
67+
const nodeEnv = isProd ? "production" : "development";
6768

6869
const ensureDir = (path: string) => {
6970
mkdirSync(path, { recursive: true });
@@ -86,6 +87,8 @@ const bunArgs = [
8687
"--splitting",
8788
"--public-path",
8889
publicPath,
90+
"--define",
91+
`process.env.NODE_ENV="${nodeEnv}"`,
8992
"--entry-naming",
9093
"[dir]-[name].[ext]",
9194
"--chunk-naming",
@@ -100,6 +103,8 @@ if (isProd) {
100103
bunArgs.push("--minify");
101104
}
102105

106+
console.log(`bun ${bunArgs.join(" ")}`);
107+
103108
const bunProc = Bun.spawn(["bun", ...bunArgs], {
104109
cwd: frontendRoot,
105110
stdout: "inherit",

0 commit comments

Comments
 (0)