From: Haoqun Jiang Date: Tue, 30 Nov 2021 13:53:24 +0000 (+0800) Subject: feat: add plugin-legacy, as the main use case for v2 is for IE11 support X-Git-Tag: v2.0.0~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4d48af846d174e336585518bf690344e3fc88b76;p=thirdparty%2Fvuejs%2Fcreate-vue.git feat: add plugin-legacy, as the main use case for v2 is for IE11 support --- 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: {