| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- import { fileURLToPath, URL } from 'node:url'
- import { defineConfig, loadEnv } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import viteImagemin from 'vite-plugin-imagemin'
- // https://vitejs.dev/config/
- export default defineConfig(({ command, mode }) => {
- return {
- base: mode === 'production' ? '/h5/' : '/',
- server: {
- host: '0.0.0.0'
- },
- plugins: [
- vue(),
- viteImagemin({
- gifsicle: {
- optimizationLevel: 7,
- interlaced: false
- },
- optipng: false,
- mozjpeg: {
- quality: 20
- },
- pngquant: {
- quality: [0.5, 0.9],
- speed: 1
- },
- svgo: {
- plugins: [
- {
- name: 'removeViewBox'
- },
- {
- name: 'removeEmptyAttrs',
- active: false
- }
- ]
- },
- webp: false
- })
- ],
- resolve: {
- alias: {
- '@': fileURLToPath(new URL('./src', import.meta.url))
- }
- },
- css: {
- preprocessorOptions: {
- less: {
- javascriptEnabled: true,
- additionalData: '@import "@/styles/common.less";'
- }
- }
- }
- }
- })
|