You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1007 B
42 lines
1007 B
import { defineConfig, loadEnv } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import { lazyImport, VxeResolver } from 'vite-plugin-lazy-import'
|
|
import legacy from '@vitejs/plugin-legacy'
|
|
import path from 'path'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, process.cwd())
|
|
console.log('当前环境:', mode)
|
|
console.log('当前环境变量:', env)
|
|
return {
|
|
esbuild: {
|
|
supported: {
|
|
bigint: true
|
|
}
|
|
},
|
|
plugins: [
|
|
vue(),
|
|
legacy({
|
|
targets: ['defaults', 'not IE 11', 'chrome >=73'],
|
|
modernPolyfills: true
|
|
}),
|
|
lazyImport({
|
|
resolvers: [
|
|
VxeResolver({
|
|
libraryName: 'vxe-table'
|
|
}),
|
|
VxeResolver({
|
|
libraryName: 'vxe-pc-ui'
|
|
})
|
|
]
|
|
})
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src')
|
|
}
|
|
},
|
|
base: process.env.NODE_ENV === 'production' ? './' : '/'
|
|
}
|
|
})
|