1.安装legacy
npm install @vitejs/plugin-legacy --save-dev
2.在vite.config.js
import legacy from '@vitejs/plugin-legacy' //引入
export default {
plugins: [
//加入这个
legacy({
targets: ['Chrome 64'],
modernPolyfills: true
}),
],
}