| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import vue from '@vitejs/plugin-vue'
- import vueJsx from '@vitejs/plugin-vue-jsx'
- import { defineConfig } from 'vite'
- import viteCompression from 'vite-plugin-compression'
- import path from 'path'
- // https://vitejs.dev/config/
- export default defineConfig(({ command, mode }) => {
- return {
- // 项目插件
- plugins: [
- vue(),
- vueJsx(),
- viteCompression({
- verbose: true,
- disable: false,
- threshold: 1025,
- algorithm: 'gzip',
- ext: '.gz',
- }),
- ],
- // 基础配置
- base: './',
- publicDir: 'public',
- resolve: {
- alias: {
- '@': path.resolve(__dirname, 'src'),
- },
- },
- css: {
- preprocessorOptions: {
- less: {
- modifyVars: {
- '@border-color-base': '#dce3e8',
- },
- javascriptEnabled: true,
- },
- },
- },
- build: {
- outDir: 'dist',
- assetsDir: 'assets',
- assetsInlineLimit: 4096,
- cssCodeSplit: true,
- brotliSize: false,
- sourcemap: false,
- minify: 'terser',
- terserOptions: {
- compress: {
- // 生产环境去除console及debug
- drop_console: false,
- drop_debugger: true,
- },
- },
- },
- }
- })
|