mirror of
https://github.com/zhouhua/obsidian-waveform-player.git
synced 2026-07-22 05:41:57 +00:00
62 lines
1.2 KiB
JavaScript
62 lines
1.2 KiB
JavaScript
|
|
import process from 'node:process';
|
||
|
|
import builtins from 'builtin-modules';
|
||
|
|
import esbuild from 'esbuild';
|
||
|
|
|
||
|
|
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 prod = process.argv[2] === 'production';
|
||
|
|
|
||
|
|
const context = await esbuild.context({
|
||
|
|
banner: {
|
||
|
|
js: banner,
|
||
|
|
},
|
||
|
|
bundle: true,
|
||
|
|
entryNames: '[dir]/[name]',
|
||
|
|
entryPoints: [
|
||
|
|
{ in: 'src/main.ts', out: 'main' },
|
||
|
|
{ in: 'main.css', out: 'styles' },
|
||
|
|
],
|
||
|
|
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',
|
||
|
|
loader: {
|
||
|
|
'.css': 'css',
|
||
|
|
},
|
||
|
|
logLevel: 'info',
|
||
|
|
// outfile: "main.js",
|
||
|
|
minify: false,
|
||
|
|
outdir: '.',
|
||
|
|
outExtension: { '.css': '.css' },
|
||
|
|
platform: 'browser',
|
||
|
|
sourcemap: prod ? false : 'inline',
|
||
|
|
target: 'es2018',
|
||
|
|
treeShaking: true,
|
||
|
|
});
|
||
|
|
|
||
|
|
if (prod) {
|
||
|
|
await context.rebuild();
|
||
|
|
process.exit(0);
|
||
|
|
}
|
||
|
|
else {
|
||
|
|
await context.watch();
|
||
|
|
}
|