Skip to content

Commit

Permalink
Upgrade esbuild to v0.17.x (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
timrogers authored Jan 25, 2023
1 parent 49fba8a commit 0b5e5a2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 24 deletions.
52 changes: 29 additions & 23 deletions esbuild.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import esbuild from "esbuild";
import process from "process";
import builtins from 'builtin-modules'
import builtins from "builtin-modules";

const banner =
`/*
Expand All @@ -9,34 +9,40 @@ if you want to view the source, please visit the github repository of this plugi
*/
`;

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

esbuild.build({
const context = await esbuild.context({
banner: {
js: banner,
},
entryPoints: ['main.ts'],
entryPoints: ["main.ts"],
bundle: true,
external: [
'obsidian',
'electron',
'@codemirror/autocomplete',
'@codemirror/collab',
'@codemirror/commands',
'@codemirror/language',
'@codemirror/lint',
'@codemirror/search',
'@codemirror/state',
'@codemirror/view',
'@lezer/common',
'@lezer/highlight',
'@lezer/lr',
"obsidian",
"electron",
"@codemirror/autocomplete",
"@codemirror/collab",
"@codemirror/commands",
"@codemirror/language",
"@codemirror/lint",
"@codemirror/search",
"@codemirror/state",
"@codemirror/view",
"@lezer/common",
"@lezer/highlight",
"@lezer/lr",
...builtins],
format: 'cjs',
watch: !prod,
target: 'es2018',
format: "cjs",
target: "es2018",
logLevel: "info",
sourcemap: prod ? false : 'inline',
sourcemap: prod ? false : "inline",
treeShaking: true,
outfile: 'main.js',
}).catch(() => process.exit(1));
outfile: "main.js",
});

if (prod) {
await context.rebuild();
process.exit(0);
} else {
await context.watch();
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@typescript-eslint/eslint-plugin": "5.29.0",
"@typescript-eslint/parser": "5.29.0",
"builtin-modules": "3.3.0",
"esbuild": "0.14.47",
"esbuild": "0.17.3",
"obsidian": "latest",
"tslib": "2.4.0",
"typescript": "4.7.4"
Expand Down

0 comments on commit 0b5e5a2

Please sign in to comment.