From 4d48af846d174e336585518bf690344e3fc88b76 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Tue, 30 Nov 2021 21:53:24 +0800 Subject: [PATCH] feat: add plugin-legacy, as the main use case for v2 is for IE11 support --- template/base/package.json | 3 ++- template/base/vite.config.js | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/template/base/package.json b/template/base/package.json index 9ccf3b91..43d63867 100644 --- a/template/base/package.json +++ b/template/base/package.json @@ -9,10 +9,11 @@ "vue": "^2.6.14" }, "devDependencies": { + "@vitejs/plugin-legacy": "^1.6.3", "@vue/runtime-dom": "^3.2.22", "unplugin-vue2-script-setup": "^0.7.1", - "vite-plugin-vue2": "^1.9.0", "vite": "^2.6.14", + "vite-plugin-vue2": "^1.9.0", "vue-template-compiler": "^2.6.14" } } diff --git a/template/base/vite.config.js b/template/base/vite.config.js index 32065ead..af324b38 100644 --- a/template/base/vite.config.js +++ b/template/base/vite.config.js @@ -1,6 +1,7 @@ import { fileURLToPath } from 'url' import { defineConfig } from 'vite' +import legacy from '@vitejs/plugin-legacy' import { createVuePlugin as vue2 } from 'vite-plugin-vue2' import scriptSetup from 'unplugin-vue2-script-setup/vite' @@ -10,7 +11,11 @@ export default defineConfig({ vue2({ jsx: true }), - scriptSetup() + scriptSetup(), + legacy({ + targets: ['ie >= 11'], + additionalLegacyPolyfills: ['regenerator-runtime/runtime'] + }) ], resolve: { alias: { -- 2.47.3