diff --git a/package.json b/package.json index 9ec8b1ed12b734569f7b2e0f86b3c62173bc1e0e..6a0b67ef422afbf925cffa8e39003a6f34c0b47f 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,10 @@ "serve": "vite preview" }, "dependencies": { + "@babel/core": "^7.14.8", + "@babel/preset-env": "^7.14.8", + "@babel/runtime": "^7.14.8", + "@rollup/plugin-babel": "^5.3.0", "axios": "^0.21.1", "element-plus": "^2.0.2", "sass": "^1.35.1", diff --git a/vite.config.js b/vite.config.js index 8c3bd1cc3f33b75a71d9d2e2b294e9a232ab6501..154b6e7f0b1a22b724ce875499ac9a4b62838391 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,5 +1,6 @@ import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' +import legacyPlugin from 'vite-plugin-legacy' const path = require('path') console.log(__dirname); @@ -10,7 +11,27 @@ function resolve_path (dir) { export default defineConfig({ - plugins: [vue()], + plugins: [ + vue(), + // The default options are listed below. Pass nothing to use them. + legacyPlugin({ + // The browsers that must be supported by your legacy bundle. + // https://babeljs.io/docs/en/babel-preset-env#targets + targets: [ 'ie >= 11' ], + // Define which polyfills your legacy bundle needs. They will be loaded + // from the Polyfill.io server. See the "Polyfills" section for more info. + polyfills: [ + // Empty by default + ], + // Toggles whether or not browserslist config sources are used. + // https://babeljs.io/docs/en/babel-preset-env#ignorebrowserslistconfig + ignoreBrowserslistConfig: false, + // When true, core-js@3 modules are inlined based on usage. + // When false, global namespace APIs (eg: Object.entries) are loaded + // from the Polyfill.io server. + corejs: false, + }) + ], base:'./', clearScreen:false, resolve:{ @@ -40,5 +61,6 @@ export default defineConfig({ build:{ outDir:'dist/zjhl', assetsDir:'static' - } + }, + })