import { defineConfig } from 'vite' // 动态配置函数标签:0.0,js,import,config,vite,defineConfig From: https://www.cnblogs.com/connie256/p/17084044.html
import { createVuePlugin } from 'vite-plugin-vue2'
import vue from '@vitejs/plugin-vue';
export default () =>
defineConfig({
plugins: [createVuePlugin()],
base:'./',
server: {
host:'0.0.0.0',
open: true, //自动打开浏览器
port: 1567 ,//端口号
hmr:{
overlay:false
}
},
define:{
'process.env':{}
},
build:{
commonjsOptions: {
transformMixedEsModules:true//解决require报错
},
rollupOptions:{
input:'index.html'
},
outDir:'judge',//输出目录
},
resolve: {
// 别名
alias: [
{
find: '@',
replacement: '/src'
}
]
}
})