大家好,
想請問vite、vue3的專案,打包後
架到apache伺服器上時,chrome瀏覽器可以開啟,
但是IE11開啟時,會是空白頁!
vite是說,它不支援IE11的瀏覽器。
於是我安裝了@vitejs/plugin-legacy的套件,
但是沒有作用.........why
以下是我的package.json跟vite.config.js配置
//package.json
{
"name": "XX",
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "vite build",
"serve": "vite preview"
},
"dependencies": {
"axios": "^0.22.0",
"chart.js": "^3.6.0",
"chartjs-plugin-datalabels": "^2.0.0-rc.1",
"v-calendar": "^3.0.0-alpha.6",
"@vitejs/plugin-legacy":"^1.6.4", //安裝這個
"vue": "^3.2.13",
"vue-i18n": "^9.2.0-beta.11",
"vue-router": "^4.0.11",
"vue3-carousel": "^0.1.27",
"vue3-click-away": "^1.2.1",
"vuex": "^4.0.2"
},
"devDependencies": {
"@vitejs/plugin-vue": "^1.9.0",
"autoprefixer": "^10.3.6",
"postcss": "^8.3.8",
"tailwindcss": "^2.2.16",
"vite": "^2.5.10"
}
}
//vite.config.js
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import legacy from '@vitejs/plugin-legacy'
export default defineConfig({
plugins: [
vue(),
// 這裡
legacy({
targets: ['ie >= 11'],
additionalLegacyPolyfills: ['regenerator-runtime/runtime']
})
],
base: "./",
build:{
chunkSizeWarningLimit:1500
}
})
是哪裡配置錯了嗎?
還是有其他的方法可以讓vite支援IE11呢?感謝