refactor: better script and vite-config

This commit is contained in:
草鞋没号
2022-02-08 11:14:05 +08:00
parent 6e184ad54c
commit 77046fc5b5
10 changed files with 144 additions and 141 deletions

View File

@@ -0,0 +1,24 @@
import { builtinModules } from 'module'
import { defineConfig } from 'vite'
import pkg from '../../package.json'
export default defineConfig({
root: __dirname,
build: {
outDir: '../../dist/main',
lib: {
entry: 'index.ts',
formats: ['cjs'],
fileName: () => '[name].cjs',
},
minify: process.env./* from mode option */NODE_ENV === 'production',
emptyOutDir: true,
rollupOptions: {
external: [
'electron',
...builtinModules,
...Object.keys(pkg.dependencies || {}),
],
},
},
})