init
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
||||
import {viteMockServe} from 'vite-plugin-mock'
|
||||
import path from 'path'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig(({command, mode}) => {
|
||||
let env = loadEnv(mode, process.cwd())
|
||||
console.log('0-0-0-')
|
||||
return {
|
||||
plugins: [
|
||||
vue(),
|
||||
createSvgIconsPlugin({
|
||||
// Specify the icon folder to be cached
|
||||
iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')],
|
||||
// Specify symbolId format
|
||||
symbolId: 'icon-[dir]-[name]',
|
||||
}),
|
||||
//mock
|
||||
viteMockServe({
|
||||
localEnabled: command === 'serve',
|
||||
}),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": path.resolve("./src") //相对路径别名配置, 使用@替代src
|
||||
}
|
||||
},
|
||||
server: {
|
||||
proxy: {
|
||||
// [env.VITE_APP_BASE_API]: {
|
||||
// target: env.VITE_SERVE,
|
||||
// changeOrigin: true,
|
||||
// rewrite: (path) => path.replace(/^\/api/, '')
|
||||
// }
|
||||
'/api': {
|
||||
target: 'https://searchplugin.csdn.net',
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
'^/api': ''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user