2024-06-01 09:08:19 +08:00
|
|
|
import { fileURLToPath, URL } from 'url'
|
|
|
|
|
|
|
|
import { defineConfig } from 'vite'
|
|
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
import vueJsx from '@vitejs/plugin-vue-jsx'
|
|
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
|
|
import Components from 'unplugin-vue-components/vite'
|
|
|
|
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
|
|
|
import { createStyleImportPlugin, ElementPlusResolve } from 'vite-plugin-style-import'
|
|
|
|
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
|
|
|
import vueSetupExtend from 'vite-plugin-vue-setup-extend'
|
|
|
|
// import legacyPlugin from '@vitejs/plugin-legacy'
|
|
|
|
// https://vitejs.dev/config/
|
|
|
|
export default defineConfig({
|
2024-06-08 10:25:21 +08:00
|
|
|
base: '/store/',
|
2024-06-01 09:08:19 +08:00
|
|
|
server: {
|
2024-06-01 09:46:44 +08:00
|
|
|
host: '0.0.0.0',
|
|
|
|
open: true,
|
|
|
|
port: 8787,
|
2024-06-01 09:08:19 +08:00
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
vue(),
|
|
|
|
vueJsx(),
|
|
|
|
AutoImport({
|
|
|
|
imports: ['vue', 'vue-router'],
|
|
|
|
resolvers: [ElementPlusResolver()],
|
|
|
|
eslintrc: {
|
|
|
|
enabled: true
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
Components({
|
|
|
|
directoryAsNamespace: true,
|
|
|
|
resolvers: [ElementPlusResolver()]
|
|
|
|
}),
|
|
|
|
createStyleImportPlugin({
|
|
|
|
resolves: [ElementPlusResolve()]
|
|
|
|
}),
|
|
|
|
createSvgIconsPlugin({
|
|
|
|
// 配置路劲在你的src里的svg存放文件
|
|
|
|
iconDirs: [fileURLToPath(new URL('./src/assets/icons', import.meta.url))],
|
|
|
|
symbolId: 'local-icon-[dir]-[name]'
|
|
|
|
}),
|
|
|
|
vueSetupExtend()
|
|
|
|
// legacyPlugin({
|
|
|
|
// targets: ['defaults', 'IE 11']
|
|
|
|
// })
|
|
|
|
],
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
|
|
}
|
|
|
|
},
|
|
|
|
build: {
|
|
|
|
rollupOptions: {
|
|
|
|
manualChunks(id) {
|
|
|
|
if (id.includes('node_modules')) {
|
|
|
|
return id.toString().split('node_modules/')[1].split('/')[0].toString()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|