代码拉取完成,页面将自动刷新
同步操作将从 Archer/vue-element-plus-admin 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import type { UserConfig, ConfigEnv } from 'vite'
import { loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite'
import { resolve } from 'path'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import vueJsx from '@vitejs/plugin-vue-jsx'
import vueSetupExtend from 'vite-plugin-vue-setup-extend'
import eslintPlugin from 'vite-plugin-eslint'
import ElementPlus from 'unplugin-element-plus/vite'
import viteSvgIcons from 'vite-plugin-svg-icons'
import commonjsExternals from 'vite-plugin-commonjs-externals'
const root = process.cwd()
function pathResolve(dir: string) {
return resolve(root, '.', dir)
}
// https://vitejs.dev/config/
export default ({ command, mode }: ConfigEnv): UserConfig => {
let env = null
if (command === 'serve') {
env = loadEnv(process.argv[4], root)
} else {
env = loadEnv(mode, root)
}
return {
base: env.VITE_BASE_PATH,
plugins: [
vue(),
vueJsx(),
vueSetupExtend(),
ElementPlus({
useSource: false
}),
Components({
dts: true,
deep: true,
dirs: ['src/components', 'src/layout'],
resolvers: [ElementPlusResolver()]
}),
eslintPlugin({
cache: false,
include: ['src/**/*.vue', 'src/**/*.ts', 'src/**/*.tsx'] // 检查的文件
}),
viteSvgIcons({
// 指定需要缓存的图标文件夹
iconDirs: [resolve(root, 'src/assets/icons')],
// 指定symbolId格式
symbolId: 'icon-[dir]-[name]',
// 压缩
svgoOptions: true
}),
commonjsExternals({
externals: ['path']
})
],
css: {
preprocessorOptions: {
less: {
additionalData: '@import "./src/styles/variables.less";',
javascriptEnabled: true
}
}
},
resolve: {
alias: [
{
find: /\@\//,
replacement: pathResolve('src') + '/'
},
{
find: /\_v\//,
replacement: pathResolve('src/views') + '/'
},
{
find: /\_c\//,
replacement: pathResolve('src/components') + '/'
}
]
},
build: {
minify: 'terser',
outDir: env.VITE_OUT_DIR,
sourcemap: env.VITE_SOURCEMAP === 'true' ? 'inline' : false,
brotliSize: false,
terserOptions: {
compress: {
drop_debugger: env.VITE_DROP_DEBUGGER === 'true',
drop_console: env.VITE_DROP_CONSOLE === 'true'
}
}
},
server: {
proxy: {
// 字符串简写写法
'/foo': 'http://localhost:4567/foo',
// 选项写法
'/api': {
target: 'http://jsonplaceholder.typicode.com',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
},
// 正则表达式写法
'^/fallback/.*': {
target: 'http://jsonplaceholder.typicode.com',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/fallback/, '')
}
}
},
optimizeDeps: {
include: [
'element-plus'
]
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。