ObsidianSimpleTimeTracker/esbuild.config.mjs

61 lines
1.6 KiB
JavaScript
Raw Normal View History

2022-09-27 15:22:31 +02:00
import esbuild from "esbuild";
import process from "process";
2022-09-27 15:36:25 +02:00
import builtins from 'builtin-modules';
import { copy } from 'esbuild-plugin-copy';
2022-09-27 15:22:31 +02:00
2022-09-27 15:36:25 +02:00
const banner = `/*
2022-09-27 15:22:31 +02: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-09-27 15:36:25 +02:00
*/`;
2022-09-27 15:22:31 +02:00
const prod = (process.argv[2] === 'production');
esbuild.build({
2023-05-22 20:01:50 +02:00
banner: {
js: banner,
},
entryPoints: ['src/main.ts'],
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',
...builtins
],
plugins: [
copy({
assets: [{
from: ["./manifest.json", "./main.js", "./styles.css"],
to: ["./test-vault/.obsidian/plugins/simple-time-tracker/."]
}]
}),
],
format: 'cjs',
watch: !prod,
target: 'es2016',
logLevel: "info",
sourcemap: prod ? false : 'inline',
treeShaking: true,
outfile: 'main.js',
2022-09-27 15:22:31 +02:00
}).catch(() => process.exit(1));