代码拉取完成,页面将自动刷新
import { defineConfig, loadEnv } from 'vite'
import electron from 'vite-plugin-electron/simple'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import path from 'node:path'
export default ({ mode }) =>
defineConfig({
plugins: [
vue(),
electron({
main: {
entry: 'electron/main.ts'
},
preload: {
input: path.join(__dirname, 'electron/preload.ts')
},
renderer:
process.env.NODE_ENV === 'test'
? // https://github.com/electron-vite/vite-plugin-electron-renderer/issues/78#issuecomment-2053600808
undefined
: {}
}),
AutoImport({
resolvers: [ElementPlusResolver()]
}),
Components({
resolvers: [ElementPlusResolver()]
})
],
base:
process.env.NODE_ENV === 'production'
? getEnv(mode).VITE_PUBLIC_PATH
: './',
server: {
host: '0.0.0.0',
port: Number(getEnv(mode).VITE_PORT),
// open: Boolean(getEnv(mode).VITE_OPEN),
open: false,
proxy: {
'/api': {
target: getEnv(mode).VITE_API_URL,
ws: true,
changeOrigin: true,
secure: false
// rewrite: (path) => path.replace(/^\/api/, '/api')
}
}
},
resolve: {
alias: {
'@': path.resolve(__dirname, '.', './src')
}
}
})
function getEnv(mode): Record<string, any> {
return loadEnv(mode, process.cwd())
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。