You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.0 KiB
49 lines
1.0 KiB
import esbuild from "esbuild"; |
|
import process from "process"; |
|
import builtins from "builtin-modules"; |
|
|
|
const isProduction = process.argv[2] === "production"; |
|
|
|
const banner = `/* |
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD |
|
if you want to view the source, please visit the github repository of this plugin |
|
*/`; |
|
|
|
const prodConfig = { |
|
banner: { |
|
js: banner, |
|
}, |
|
entryPoints: ["src/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", |
|
...builtins, |
|
], |
|
format: "cjs", |
|
target: "es2018", |
|
logLevel: "info", |
|
sourcemap: isProduction ? false : "inline", |
|
treeShaking: true, |
|
outfile: "main.js", |
|
}; |
|
|
|
const devConfig = { |
|
...prodConfig, |
|
sourcemap: "inline", |
|
}; |
|
|
|
const config = isProduction ? prodConfig : devConfig; |
|
|
|
esbuild.build(config).catch(() => process.exit(1));
|
|
|