项目脚手架:vue-cli 3.x,用了 vue + vue-router + iview
iview为按需引入,用了:Row, Col, Button, Carousel, CarouselItem, Icon
问题描述
问题:在高版本浏览器访问正常,在安卓4.4.4 webview(内核为Chrome 33)中访问,页面空白,调试报错为:
Uncaught SyntaxError: Use of const in strict mode. app.js:4328
./node_modules/iview/src/utils/assist.js app.js:4328
__webpack_require__ app.js:768
fn app.js:131
./node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js?!./node_modules/iview/src/components/carousel/carousel.vue?vue&type=script&lang=js& app.js:1001
__webpack_require__ app.js:768
fn app.js:131
./node_modules/iview/src/components/carousel/carousel.vue?vue&type=script&lang=js& app.js:4103
__webpack_require__ app.js:768
fn app.js:131
./node_modules/iview/src/components/carousel/carousel.vue app.js:4091
__webpack_require__ app.js:768
fn app.js:131
./node_modules/iview/src/components/carousel/index.js app.js:4127
__webpack_require__ app.js:768
fn app.js:131
./src/plugins/iview.js app.js:5328
__webpack_require__ app.js:768
fn app.js:131
./src/main.js app.js:5316
__webpack_require__ app.js:768
fn app.js:131
(anonymous function) app.js:5412
__webpack_require__ app.js:768
(anonymous function) app.js:904
(anonymous function)
尝试解决
看报错可能是ES6+语法问题,于是尝试通过添加polyfill,按vue-cli 3.x文档polyfill相关指南,使用了其第3种方式:
babel.config.js:
presets: [
['@vue/app', {
useBuiltIns: 'entry'
}]
]
main.js:
import '@babel/polyfill'
.browserslistrc:
chrome >= 33
android >= 4.4
测试问题没有解决
相关链接
求指导,求建议