mirror of
https://github.com/gavvvr/obsidian-imgur-plugin.git
synced 2026-07-22 05:10:27 +00:00
2 reasons to remove 'obsidian-plugin-cli' dependency: - it uses its own esbuild config, which might be different from the one used for prod build - it brings lots of unused stuff (including deprecated transitive dependencies)
23 lines
436 B
JavaScript
23 lines
436 B
JavaScript
// @ts-check
|
|
|
|
import process from 'node:process'
|
|
|
|
import esbuild from 'esbuild'
|
|
|
|
import { sharedEsbuildConfig } from './esbuild.config.js'
|
|
|
|
const config = sharedEsbuildConfig
|
|
|
|
const prod = process.argv[2] === 'production'
|
|
|
|
const context = await esbuild.context({
|
|
...config,
|
|
...{ sourcemap: prod ? false : 'inline', outfile: 'main.js' },
|
|
})
|
|
|
|
if (prod) {
|
|
await context.rebuild()
|
|
process.exit(0)
|
|
} else {
|
|
await context.watch()
|
|
}
|