報(bào)錯信息:
Uncaught TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
出現(xiàn)這個(gè)問題的原因,是在引用mui中的mui.js文件時(shí)報(bào)的錯誤,由于在webpack中,采用的時(shí)嚴(yán)格模式,而mui.js用了非嚴(yán)格模式的寫法。
解決方法:
- 1.把mui.js里面的內(nèi)容改成嚴(yán)格模式,但這不可能,畢竟我們要引用他們。
- 只能把webpack改為非嚴(yán)格模式了
安裝:
cnpm i babel-plugin-transform-remove-strict-mode -D
在.babelrc中進(jìn)行配置:
plugins: [
"transform-remove-strict-mode" //配置插件,這里很重要
]
就解決了。
......
然鵝,
啟動項(xiàng)目npm run serve 報(bào)錯
Module build failed (from ./node_modules/_babel-loader@8.0.6@babel-loader/lib/index.js):
TypeError: this.setDynamic is not a function
原因:vue項(xiàng)目用的是最新的babel7版本,在.babel.config.js中使用的還是之前的插件.babel7之后的插件一般都是以@babel開頭的,下載新版的babel安裝包之后再運(yùn)行就可以了
安裝改為
cnpm i @babel/plugin-transform-modules-commonjs @babel/plugin-transform-strict-mode -D
在babel.config.js中進(jìn)行配置(vue-cli3 中 沒有.babelrc文件)
plugins: [
["@babel/plugin-transform-modules-commonjs", { "strictMode": false }]
],