Skip to content

Commit

Permalink
Update esbuild.config
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Jan 5, 2024
1 parent 9a8403d commit 4cbdc79
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions esbuild.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ if you want to view the source, please visit the github repository of this plugi

const prod = process.argv[2] === "production";

esbuild
.build({
const context = await esbuild
.context({
banner: {
js: banner,
},
Expand Down Expand Up @@ -43,11 +43,16 @@ esbuild
preprocess: sveltePreprocess(),
}),
],
watch: !prod,
target: "es2018",
logLevel: "info",
sourcemap: prod ? false : "inline",
treeShaking: true,
outfile: "main.js",
})
.catch(() => process.exit(1));

if (prod) {
await context.rebuild();
process.exit(0);
} else {
await context.watch();
}

0 comments on commit 4cbdc79

Please sign in to comment.