55 lines
1.3 KiB
JavaScript
55 lines
1.3 KiB
JavaScript
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import path from 'path'
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
import Components from 'unplugin-vue-components/vite'
|
|
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
vue(),
|
|
AutoImport({
|
|
resolvers: [ElementPlusResolver({ importStyle: 'sass' })],
|
|
dts: false
|
|
}),
|
|
Components({
|
|
resolvers: [ElementPlusResolver({ importStyle: 'sass' })],
|
|
dts: false
|
|
})
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, 'src')
|
|
}
|
|
},
|
|
css: {
|
|
preprocessorOptions: {
|
|
scss: {
|
|
api: 'modern-compiler',
|
|
silenceDeprecations: ['legacy-js-api']
|
|
}
|
|
}
|
|
},
|
|
server: {
|
|
port: 5173
|
|
},
|
|
build: {
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks(id) {
|
|
if (!id.includes('node_modules')) return
|
|
|
|
if (id.includes('element-plus')) return 'element-plus'
|
|
if (id.includes('echarts')) return 'echarts'
|
|
|
|
if (id.includes('axios')) return 'axios'
|
|
if (id.includes('element-china-area-data')) return 'china-area'
|
|
if (id.includes('highlight.js')) return 'highlight'
|
|
|
|
// other deps: let Rollup decide to avoid circular chunks
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|