From 13f102240d9c0c9d5a133fb093551f2e08d7c55c Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期五, 19 一月 2024 16:47:41 +0800 Subject: [PATCH] ie不支持es6的问题,安装插件,配置 --- vite.config.ts | 46 ++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 42 insertions(+), 4 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index a45bed3..4e64e31 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -6,7 +6,8 @@ import IconsResolver from 'unplugin-icons/resolver' import Icons from 'unplugin-icons/vite' import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' - +// 鍏煎浣庣増鏈祻瑙堝櫒 +import legacy from '@vitejs/plugin-legacy' const pathSrc = path.resolve(__dirname, 'src') // https://vitejs.dev/config/ @@ -23,7 +24,12 @@ resolve: { alias: { '@': pathSrc - } + }, + }, + + build: { + target:['chrome52'], + cssTarget:["chrome52"], }, plugins: [ vue(), @@ -42,6 +48,32 @@ dts: path.resolve(pathSrc, 'auto-imports.d.ts') }), + + // 鍏煎浣庣増鏈祻瑙堝櫒 + legacy({ + targets: ['defaults', 'ie >= 11', 'chrome < 60','firefox < 59'], //闇�瑕佸吋瀹圭殑鐩爣鍒楄〃锛屽彲浠ヨ缃涓� + additionalLegacyPolyfills: ['regenerator-runtime/runtime'], + renderLegacyChunks: true, + modernPolyfills: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' + ] + }), Components({ resolvers: [ // 鑷姩娉ㄥ唽鍥炬爣缁勪欢 @@ -55,6 +87,12 @@ }), Icons({ autoInstall: true - }) - ] + }), + ], + configureWebpack:config=>{ + config.entry.app=['babel-polyfill','./src/main.js'] + }, + // chainWebpack: (config) => { + // config.entry('main').add('babel-polyfill') + // }, }) -- Gitblit v1.8.0