ObsidianCustomFrames/esbuild.config.mjs

52 lines
1.2 KiB
JavaScript
Raw Permalink Normal View History

2022-03-19 20:21:16 +01:00
import esbuild from "esbuild";
import process from "process";
2022-03-29 13:19:33 +02:00
import builtins from 'builtin-modules';
2022-03-19 20:21:16 +01:00
2022-03-29 13:19:33 +02:00
const banner = `/*
2022-03-19 20:21:16 +01:00
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
2022-03-29 13:19:33 +02:00
*/`;
2022-03-19 20:21:16 +01:00
const prod = (process.argv[2] === 'production');
esbuild.build({
banner: {
js: banner,
},
2022-03-29 13:18:25 +02:00
entryPoints: ['src/main.ts'],
2022-03-19 20:21:16 +01:00
bundle: true,
external: [
'obsidian',
'electron',
'@codemirror/autocomplete',
'@codemirror/closebrackets',
'@codemirror/collab',
'@codemirror/commands',
'@codemirror/comment',
'@codemirror/fold',
'@codemirror/gutter',
'@codemirror/highlight',
'@codemirror/history',
'@codemirror/language',
'@codemirror/lint',
'@codemirror/matchbrackets',
'@codemirror/panel',
'@codemirror/rangeset',
'@codemirror/rectangular-selection',
'@codemirror/search',
'@codemirror/state',
'@codemirror/stream-parser',
'@codemirror/text',
'@codemirror/tooltip',
'@codemirror/view',
2022-03-29 13:18:25 +02:00
...builtins
],
2022-03-19 20:21:16 +01:00
format: 'cjs',
watch: !prod,
target: 'es2016',
logLevel: "info",
sourcemap: prod ? false : 'inline',
treeShaking: true,
outfile: 'main.js',
}).catch(() => process.exit(1));