Vue CLI 3 + Vuetify - Not working on IE 11 (Babel does not transpile?)

萝らか妹 提交于 2019-12-10 15:23:53

问题


I’m using Vue CLI 3 with Vuetify for my project. It works well on Chrome and iOS 12, but it shows blank page on IE11 and iOS Safari < 12. The console in IE11 shows: SCRIPT1003: Expected ':'

I think it’s because Babel does not transpile the ES6 syntax (arrow function, spread, etc) to ES5 syntax. I still see it in the compiled code after running yarn build.

Here is my babel.config.js:

//bable.config.js
module.exports = {
presets: [
  [ '@vue/app', {
     useBuiltIns: 'entry'
  }]
 ]
}

Here is my .browserslistrc:

//.browserslistrc
> 1%
last 2 versions
not ie <= 8

main.js is something like this:

// main.js
import '@babel/polyfill'
import Vue from 'vue'
import './plugins/vuetify'
import App from './App.vue'
import router from './router'
import store from './store/store'
import { firebaseListener } from './firebaseConfig'

Vue.config.productionTip = false

Please help me! Thanks and Regards.


回答1:


babel.config.js

  module.exports = {
     presets: [['@vue/app', { useBuiltIns: 'entry' }]],
  }

main.js

import '@babel/polyfill' // At the top of the file, and make sure @babel/polyfill is installed


来源:https://stackoverflow.com/questions/53420392/vue-cli-3-vuetify-not-working-on-ie-11-babel-does-not-transpile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!