zhongshujie
3 天以前 b385fcc30e0ee871dc31c06526e9ab84ba507ea2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import legacyPlugin from '@vitejs/plugin-legacy'
 
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    legacyPlugin({
      targets: ['defaults', 'chrome 52', 'ie >= 11','Safari >= 8'],  // 需要兼容的目标列表,可以设置多个
      additionalLegacyPolyfills: ['regenerator-runtime/runtime'], // 面向IE11时需要此插件
      renderLegacyChunks: true,
      polyfills: true,
      modernPolyfills: true,
    })
  ],
  build:{target: ['ios8', 'edge90', 'chrome52', 'firefox90', 'safari8']},
  server: {
    host: '0.0.0.0' // Expose to all network interfaces
    // port: 5174, // Default Vite port
  },
  base: "./",
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src')
    }
  },
  css: {
    preprocessorOptions: {
      less: {
        javascriptEnabled: true
      }
    }
  }
})