init:库尔勒妇幼项目初始化
This commit is contained in:
62
vite.config.js
Normal file
62
vite.config.js
Normal file
@@ -0,0 +1,62 @@
|
||||
import {defineConfig, loadEnv} from 'vite'
|
||||
import path from 'path'
|
||||
import createVitePlugins from './vite/plugins'
|
||||
|
||||
export default defineConfig(({mode, command}) => {
|
||||
const env = loadEnv(mode, process.cwd())
|
||||
const {VITE_APP_ENV} = env
|
||||
return {
|
||||
base: VITE_APP_ENV === 'production' ? '/' : '/',
|
||||
plugins: createVitePlugins(env, command === 'build'),
|
||||
resolve: {
|
||||
// https://cn.vitejs.dev/config/#resolve-alias
|
||||
alias: {
|
||||
// 设置路径
|
||||
'~':
|
||||
path.resolve(__dirname, './'),
|
||||
// 设置别名
|
||||
'@':
|
||||
path.resolve(__dirname, './src')
|
||||
}
|
||||
,
|
||||
// https://cn.vitejs.dev/config/#resolve-extensions
|
||||
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
|
||||
}
|
||||
,
|
||||
// vite 相关配置
|
||||
server: {
|
||||
hmr: true,
|
||||
port:
|
||||
8099,
|
||||
host:
|
||||
true,
|
||||
open:
|
||||
true,
|
||||
proxy:
|
||||
{
|
||||
// https://cn.vitejs.dev/config/#server-proxy
|
||||
'/dev-api':
|
||||
{
|
||||
target: 'http://localhost:8083',
|
||||
// target: 'http://110.153.1.138:8081',
|
||||
changeOrigin:
|
||||
true,
|
||||
rewrite:
|
||||
(p) => p.replace(/^\/dev-api/, ''),
|
||||
}
|
||||
,
|
||||
'/prod-api':
|
||||
{
|
||||
target: 'http://110.153.1.138:8081',
|
||||
changeOrigin:
|
||||
true,
|
||||
rewrite:
|
||||
(p) => p.replace(/^\/prod-api/, '/prod-api/'),
|
||||
}
|
||||
}
|
||||
}
|
||||
,
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
Reference in New Issue
Block a user