mirror of
https://github.com/fancive/obsidian-parallel-reader.git
synced 2026-07-22 06:53:43 +00:00
Both were ES2020 while lib was already ES2022, creating a mismatch that could allow using APIs esbuild wouldn't polyfill. Obsidian 1.4+ runs Electron 25+ which fully supports ES2022. Change-Id: I732538280146c6a91cf52cc52ef124f6a364dc5e
36 lines
739 B
JavaScript
36 lines
739 B
JavaScript
import esbuild from 'esbuild';
|
|
import { builtinModules } from 'module';
|
|
|
|
const production = process.argv[2] === 'production';
|
|
const watch = process.argv[2] === 'watch';
|
|
|
|
const external = [
|
|
'obsidian',
|
|
'electron',
|
|
...builtinModules,
|
|
...builtinModules.map(m => `node:${m}`),
|
|
];
|
|
|
|
const context = await esbuild.context({
|
|
entryPoints: ['main.ts'],
|
|
bundle: true,
|
|
platform: 'node',
|
|
format: 'cjs',
|
|
target: 'es2022',
|
|
external,
|
|
sourcemap: production ? false : 'inline',
|
|
treeShaking: true,
|
|
minify: production,
|
|
outfile: 'main.js',
|
|
banner: {
|
|
js: "'use strict';",
|
|
},
|
|
});
|
|
|
|
if (watch) {
|
|
await context.watch();
|
|
console.log('Watching for changes...');
|
|
} else {
|
|
await context.rebuild();
|
|
await context.dispose();
|
|
}
|