Vue CLI 3 + Vuetify-在IE 11上不起作用(Babel不能进行翻译吗?) [英] Vue CLI 3 + Vuetify - Not working on IE 11 (Babel does not transpile?)
问题描述
我正在将Vue CLI 3和Vuetify一起用于我的项目.它在Chrome和iOS 12上运行良好,但在IE11和iOS Safari上显示空白页. 12. IE11中的控制台显示:SCRIPT1003: Expected ':'
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 ':'
我认为这是因为Babel并未将ES6语法(箭头功能,传播等)转换为ES5语法.运行yarn build之后,我仍然在编译后的代码中看到它.
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.
这是我的babel.config.js:
Here is my babel.config.js:
//bable.config.js
module.exports = {
presets: [
[ '@vue/app', {
useBuiltIns: 'entry'
}]
]
}
这是我的.browserslistrc
:
//.browserslistrc
> 1%
last 2 versions
not ie <= 8
main.js
是这样的:
// 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.
推荐答案
babel.config.js
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
这篇关于Vue CLI 3 + Vuetify-在IE 11上不起作用(Babel不能进行翻译吗?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!