ozntel_oz-calendar/esbuild.config.mjs

50 lines
997 B
JavaScript
Raw Permalink Normal View History

2023-03-10 08:06:36 +00:00
import esbuild from 'esbuild';
import process from 'process';
import builtins from 'builtin-modules';
2023-03-10 07:51:20 +00:00
2023-03-10 08:06:36 +00:00
const banner = `/*
2023-03-10 07:51:20 +00:00
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
2023-03-10 08:06:36 +00:00
https://github.com/ozntel/oz-calendar
2023-03-10 07:51:20 +00:00
*/
`;
2023-03-10 08:06:36 +00:00
const prod = process.argv[2] === 'production';
2023-03-10 07:51:20 +00:00
const context = await esbuild.context({
banner: {
js: banner,
},
2023-03-10 08:06:36 +00:00
entryPoints: ['src/main.ts'],
2023-03-10 07:51:20 +00:00
bundle: true,
external: [
2023-03-10 08:06:36 +00:00
'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: prod ? false : 'inline',
2023-03-10 07:51:20 +00:00
treeShaking: true,
2023-03-10 08:06:36 +00:00
outfile: 'main.js',
2023-03-10 07:51:20 +00:00
});
if (prod) {
await context.rebuild();
process.exit(0);
} else {
await context.watch();
2023-03-10 08:06:36 +00:00
}