2021-02-18 16:11:08 +08:00
|
|
|
require('dotenv').config({ path: join(__dirname, '.env') })
|
|
|
|
|
2021-02-17 22:27:40 +08:00
|
|
|
import { defineConfig } from 'vite'
|
|
|
|
import vue from '@vitejs/plugin-vue'
|
2021-02-18 16:11:08 +08:00
|
|
|
import externals from 'rollup-plugin-node-externals'
|
|
|
|
import { join } from 'path'
|
|
|
|
import { cjs2esm } from './script/utils'
|
2020-08-16 20:42:52 +08:00
|
|
|
|
2021-02-17 22:27:40 +08:00
|
|
|
// https://vitejs.dev/config/
|
|
|
|
export default defineConfig({
|
|
|
|
plugins: [vue()],
|
2021-02-18 16:11:08 +08:00
|
|
|
root: join(__dirname, 'src/render'),
|
2021-02-18 17:29:45 +08:00
|
|
|
base: './', // index.html 中静态资源加载位置
|
2021-02-17 22:27:40 +08:00
|
|
|
server: {
|
|
|
|
port: +process.env.PORT,
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
2021-02-18 16:11:08 +08:00
|
|
|
'@': join(__dirname, 'src/render'),
|
2021-02-17 22:27:40 +08:00
|
|
|
'@root': __dirname,
|
|
|
|
},
|
2020-08-31 09:50:57 +08:00
|
|
|
},
|
|
|
|
optimizeDeps: {
|
2021-02-18 16:11:08 +08:00
|
|
|
exclude: ['electron-store', 'electron']
|
2020-08-31 09:50:57 +08:00
|
|
|
},
|
2021-02-17 22:27:40 +08:00
|
|
|
build: {
|
|
|
|
outDir: join(__dirname, 'dist/render'),
|
|
|
|
rollupOptions: {
|
2021-02-18 16:11:08 +08:00
|
|
|
external: ['electron'],
|
2021-02-17 22:27:40 +08:00
|
|
|
plugins: [
|
2021-02-18 16:11:08 +08:00
|
|
|
externals(),
|
|
|
|
// cjs2esm(),
|
2021-02-17 22:27:40 +08:00
|
|
|
],
|
|
|
|
},
|
2020-09-25 11:39:39 +08:00
|
|
|
},
|
2021-02-17 22:27:40 +08:00
|
|
|
})
|