2022-04-15 07:35:20 +08:00
|
|
|
import { join } from 'path'
|
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',
|
2022-04-15 07:52:22 +08:00
|
|
|
emptyOutDir: true,
|
2022-02-08 11:14:05 +08:00
|
|
|
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: {
|
2022-04-15 07:35:20 +08:00
|
|
|
input: {
|
|
|
|
// multiple entry
|
|
|
|
index: join(__dirname, 'index.ts'),
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
format: 'cjs',
|
|
|
|
entryFileNames: '[name].cjs',
|
|
|
|
manualChunks: {},
|
|
|
|
},
|
2022-02-08 11:14:05 +08:00
|
|
|
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 || {}),
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|