Skip to content

Commit

Permalink
chore: update esbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
valentine195 committed Sep 20, 2023
1 parent c25f3ab commit 3ffbf01
Showing 1 changed file with 38 additions and 26 deletions.
64 changes: 38 additions & 26 deletions esbuild.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,41 @@ const prod = process.argv[2] === "production";

const dir = prod ? "./" : process.env.OUTDIR;

esbuild
.build({
banner: {
js: banner
},
entryPoints: ["src/main.ts", "src/styles.css"],
bundle: true,
external: ["obsidian", "electron", ...builtins],
format: "cjs",
watch: !prod,
target: "es2020",
logLevel: "info",
sourcemap: prod ? false : "inline",
treeShaking: true,
plugins: [
sveltePlugin({
compilerOptions: { css: true },
preprocess: sveltePreprocess(),
filterWarnings: (warning) => {
return warning.code != "a11y-click-events-have-key-events";
}
})
],
outdir: dir
})
.catch(() => process.exit(1));
const parameters = {
banner: {
js: banner
},
entryPoints: ["src/main.ts", "src/styles.css"],
bundle: true,
external: ["obsidian", "electron", ...builtins],
format: "cjs",
logLevel: "info",
target: "es2020",
treeShaking: true,
sourcemap: prod ? false : "inline",
minify: prod,
plugins: [
sveltePlugin({
compilerOptions: { css: true },
preprocess: sveltePreprocess(),
filterWarnings: (warning) => {
return warning.code != "a11y-click-events-have-key-events";
}
})
],
outdir: dir
};

if (prod) {
await esbuild.build(parameters).catch((x) => {
if (x.errors) {
console.error(x.errors);
} else {
console.error(x);
}
process.exit(1);
});
} else {
let ctx = await esbuild.context(parameters);
await ctx.watch();
}

0 comments on commit 3ffbf01

Please sign in to comment.