|
|
|
|
import { defineConfig, loadEnv } from 'vite'
|
|
|
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
|
|
|
import Components from 'unplugin-vue-components/vite'
|
|
|
|
|
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
|
|
|
|
import { resolve } from 'path'
|
|
|
|
|
|
|
|
|
|
// https://vite.dev/config/
|
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
|
|
|
const env = loadEnv(mode, process.cwd(), '')
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
plugins: [
|
|
|
|
|
vue(),
|
|
|
|
|
AutoImport({
|
|
|
|
|
imports: ['vue', 'vue-router', 'pinia'],
|
|
|
|
|
resolvers: [ElementPlusResolver()],
|
|
|
|
|
dts: 'src/auto-imports.d.ts',
|
|
|
|
|
}),
|
|
|
|
|
Components({
|
|
|
|
|
resolvers: [ElementPlusResolver()],
|
|
|
|
|
dts: 'src/components.d.ts',
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
resolve: {
|
|
|
|
|
alias: {
|
|
|
|
|
'@': resolve(__dirname, 'src'),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
css: {
|
|
|
|
|
preprocessorOptions: {
|
|
|
|
|
scss: {
|
|
|
|
|
additionalData: `@import "@/styles/variables.scss";\n`
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
server: {
|
feat: migrate business modules to Vue3
- Migrate system management pages: user, role, menu, dept, dict, notice, post, config
- Migrate booksystem pages: account, book, statistics, operations
- Migrate stocksystem pages: stocks, trends, stockindex, stockbasic
- Create corresponding API modules with TypeScript types
- Update router configuration with all module routes
- Add permission control (v-hasPermi directive) to all pages
3 weeks ago
|
|
|
port: 5173,
|
|
|
|
|
host: true,
|
|
|
|
|
proxy: {
|
|
|
|
|
'/dev-api': {
|
|
|
|
|
target: env.VITE_API_URL || 'http://localhost:8080',
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
rewrite: (path) => path.replace(/^\/dev-api/, ''),
|
|
|
|
|
},
|
|
|
|
|
'/prod-api': {
|
|
|
|
|
target: env.VITE_API_URL || 'http://localhost:8080',
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
rewrite: (path) => path.replace(/^\/prod-api/, ''),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
build: {
|
|
|
|
|
target: 'es2015',
|
|
|
|
|
outDir: 'dist',
|
|
|
|
|
assetsDir: 'assets',
|
|
|
|
|
sourcemap: false,
|
|
|
|
|
chunkSizeWarningLimit: 1500,
|
|
|
|
|
rollupOptions: {
|
|
|
|
|
output: {
|
|
|
|
|
manualChunks(id) {
|
|
|
|
|
if (id.includes('element-plus')) {
|
|
|
|
|
return 'element-plus'
|
|
|
|
|
}
|
|
|
|
|
if (id.includes('node_modules') && (id.includes('vue') || id.includes('vue-router') || id.includes('pinia'))) {
|
|
|
|
|
return 'vue-vendor'
|
|
|
|
|
}
|
|
|
|
|
if (id.includes('echarts')) {
|
|
|
|
|
return 'echarts'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
})
|