mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-01-19 11:56:36 +08:00
37 lines
841 B
TypeScript
37 lines
841 B
TypeScript
require('dotenv').config({ path: join(__dirname, '.env') })
|
|
|
|
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import externals from 'rollup-plugin-node-externals'
|
|
import { join } from 'path'
|
|
import { cjs2esm } from './script/utils'
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
plugins: [vue()],
|
|
root: join(__dirname, 'src/render'),
|
|
base: './', // index.html 中静态资源加载位置
|
|
server: {
|
|
port: +process.env.PORT,
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': join(__dirname, 'src/render'),
|
|
'@root': __dirname,
|
|
},
|
|
},
|
|
optimizeDeps: {
|
|
exclude: ['electron-store', 'electron']
|
|
},
|
|
build: {
|
|
outDir: join(__dirname, 'dist/render'),
|
|
rollupOptions: {
|
|
external: ['electron'],
|
|
plugins: [
|
|
externals(),
|
|
// cjs2esm(),
|
|
],
|
|
},
|
|
},
|
|
})
|