2022-02-08 11:14:05 +08:00
|
|
|
import { builtinModules } from 'module'
|
|
|
|
import { defineConfig } from 'vite'
|
|
|
|
import pkg from '../../package.json'
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
root: __dirname,
|
|
|
|
build: {
|
|
|
|
outDir: '../../dist/preload',
|
|
|
|
lib: {
|
|
|
|
entry: 'index.ts',
|
|
|
|
formats: ['cjs'],
|
|
|
|
fileName: () => '[name].cjs',
|
|
|
|
},
|
|
|
|
minify: process.env./* from mode option */NODE_ENV === 'production',
|
2022-03-05 07:44:34 +08:00
|
|
|
// https://github.com/caoxiemeihao/electron-vue-vite/issues/61
|
|
|
|
sourcemap: 'inline',
|
2022-02-08 11:14:05 +08:00
|
|
|
rollupOptions: {
|
|
|
|
external: [
|
|
|
|
'electron',
|
|
|
|
...builtinModules,
|
2022-04-06 14:52:20 +08:00
|
|
|
// @ts-ignore
|
2022-02-08 11:14:05 +08:00
|
|
|
...Object.keys(pkg.dependencies || {}),
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|