import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import styleImport from 'vite-plugin-style-import' import vueJsx from '@vitejs/plugin-vue-jsx' import legacy from '@vitejs/plugin-legacy' // eslint-disable-next-line @typescript-eslint/no-var-requires const path = require('path') function resolve(dir: string) { return path.join(__dirname, dir) } // https://vitejs.dev/config/ // https://github.com/vitejs/vite/issues/1930 .env // const proxyUrl = 'https://online.colexiu.com/' const proxyUrl = 'https://test.colexiu.com/' // const proxyUrl = 'http://192.168.3.14:8000/' export default defineConfig({ base: './', plugins: [ vue(), vueJsx(), legacy({ targets: ['> 0.25%, not dead'], ignoreBrowserslistConfig: true // targets: ['chrome 52'], // additionalLegacyPolyfills: ['regenerator-runtime/runtime'], // renderLegacyChunks: true, // polyfills: [ // 'es.symbol', // 'es.array.filter', // 'es.promise', // 'es.promise.finally', // 'es/map', // 'es/set', // 'es.array.for-each', // 'es.object.define-properties', // 'es.object.define-property', // 'es.object.get-own-property-descriptor', // 'es.object.get-own-property-descriptors', // 'es.object.keys', // 'es.object.to-string', // 'web.dom-collections.for-each', // 'esnext.global-this', // 'esnext.string.match-all' // ] }), styleImport({ libs: [ { libraryName: 'vant', esModule: true, resolveStyle: name => `vant/es/${name}/style` } ] }) ], resolve: { alias: { '@': resolve('./src'), '@common': resolve('./src/common'), '@components': resolve('./src/components'), '@business-components': resolve('./src/business-components'), '@store': resolve('./src/store'), '@views': resolve('./src/views') } }, server: { host: '0.0.0.0', port: 5000, strictPort: true, cors: true, proxy: { '/api-auth': { target: proxyUrl, changeOrigin: true }, '/api-student': { target: proxyUrl, changeOrigin: true }, '/api-teacher': { target: proxyUrl, changeOrigin: true }, '/api-web': { target: proxyUrl, changeOrigin: true }, '/api-cms': { target: proxyUrl, changeOrigin: true }, '/api-admin': { target: proxyUrl, changeOrigin: true }, '/music': { target: proxyUrl, changeOrigin: true }, '/api-mall-portal': { target: proxyUrl, changeOrigin: true }, '/api-tenant': { target: proxyUrl, changeOrigin: true } } }, build: { rollupOptions: { input: { index: resolve('index.html'), teacher: resolve('teacher.html'), tenant: resolve('tenant.html') } } } })