import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import vueJsx from "@vitejs/plugin-vue-jsx"; import legacy from '@vitejs/plugin-legacy'; import path from "path"; declare let __dirname:string; export default defineConfig({ plugins: [vue(),vueJsx(), legacy({ 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' ], modernPolyfills:true }), ], esbuild: { jsxFactory: 'createVNode', jsxFragment: 'Fragment', jsxInject: "import { createVNode } from 'vue';" }, build: { target: 'es2015' }, resolve: { alias: { '@': path.resolve(__dirname, './src/'), '$request': path.resolve(__dirname, './src/system/request/'), '@ant-design/icons/lib/dist$': path.resolve(__dirname, './src/system/icon/index.ts'), '$data':path.resolve(__dirname, './src/system/data/'), '$config':path.resolve(__dirname, './src/system/config/'), '$utils':path.resolve(__dirname,'./src/system/utils/'), '$const':path.resolve(__dirname,'./src/system/const/'), '$api':path.resolve(__dirname, './src/api/'), "$store": path.resolve(__dirname, "./src/store/"), } }, css: { preprocessorOptions: { scss: { additionalData: ` @use "/src/system/styles/variable/index.scss" as *; ` }, less: { modifyVars: { // 此处也可设置直角、边框色、字体大小等 'primary-color': '#2F6BEE' }, javascriptEnabled: true } } } })