2021-10-25 15:45:15 +00:00
|
|
|
import esbuild from "esbuild";
|
|
|
|
import process from "process";
|
2021-11-01 19:17:03 +00:00
|
|
|
import builtins from 'builtin-modules'
|
2021-10-25 15:45:15 +00:00
|
|
|
|
2021-11-01 19:17:03 +00:00
|
|
|
const banner =
|
2021-10-25 15:45:15 +00:00
|
|
|
`/*
|
|
|
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
2021-11-01 19:17:03 +00:00
|
|
|
if you want to view the source, please visit the github repository of this plugin
|
2021-10-25 15:45:15 +00:00
|
|
|
*/
|
|
|
|
`;
|
|
|
|
|
|
|
|
const prod = (process.argv[2] === 'production');
|
|
|
|
|
|
|
|
esbuild.build({
|
2021-11-01 19:17:03 +00:00
|
|
|
banner: {
|
|
|
|
js: banner,
|
|
|
|
},
|
|
|
|
entryPoints: ['main.ts'],
|
|
|
|
bundle: true,
|
2022-01-10 14:01:38 +00:00
|
|
|
external: [
|
|
|
|
'obsidian',
|
|
|
|
'electron',
|
|
|
|
'@codemirror/autocomplete',
|
|
|
|
'@codemirror/collab',
|
|
|
|
'@codemirror/commands',
|
|
|
|
'@codemirror/language',
|
|
|
|
'@codemirror/lint',
|
|
|
|
'@codemirror/search',
|
|
|
|
'@codemirror/state',
|
|
|
|
'@codemirror/view',
|
2022-06-20 00:50:11 +00:00
|
|
|
'@lezer/common',
|
|
|
|
'@lezer/highlight',
|
|
|
|
'@lezer/lr',
|
2022-01-10 14:01:38 +00:00
|
|
|
...builtins],
|
2021-11-01 19:17:03 +00:00
|
|
|
format: 'cjs',
|
|
|
|
watch: !prod,
|
2022-08-21 00:25:17 +00:00
|
|
|
target: 'es2018',
|
2021-11-01 19:17:03 +00:00
|
|
|
logLevel: "info",
|
|
|
|
sourcemap: prod ? false : 'inline',
|
|
|
|
treeShaking: true,
|
|
|
|
outfile: 'main.js',
|
2021-10-25 15:45:15 +00:00
|
|
|
}).catch(() => process.exit(1));
|