mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-01-31 20:16:36 +08:00
27 lines
694 B
TypeScript
27 lines
694 B
TypeScript
/**
|
|
* 参考链接: https://github.com/vitejs/vite/blob/master/src/node/config.ts
|
|
*/
|
|
import { join } from 'path'
|
|
import { UserConfig } from 'vite'
|
|
import dotenv from 'dotenv'
|
|
|
|
dotenv.config({ path: join(__dirname, '.env') })
|
|
const root = join(__dirname, 'src/render')
|
|
|
|
const config: UserConfig = {
|
|
root,
|
|
port: +process.env.PORT,
|
|
base: './',
|
|
outDir: join(__dirname, 'dist/render'),
|
|
alias: {
|
|
// 别名必须以 / 开头、结尾
|
|
'/@/': root,
|
|
},
|
|
optimizeDeps: {
|
|
// 这里不加也没事,用 require 的形式就能避开 import 被编译成 /@modules/fs?import
|
|
// allowNodeBuiltins: ['electron-is-dev', 'electron-store', 'electron']
|
|
},
|
|
}
|
|
|
|
export default config
|