報錯信息:
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)這個問題的原因刮刑,是在引用mui中的mui.js文件時報的錯誤,由于在webpack中泛烙,采用的時嚴格模式,而mui.js用了非嚴格模式的寫法蔽氨。
解決方法:
- 1.把mui.js里面的內(nèi)容改成嚴格模式,但這不可能鹉究,畢竟我們要引用他們。
- 只能把webpack改為非嚴格模式了
安裝:
cnpm i babel-plugin-transform-remove-strict-mode -D
在.babelrc中進行配置:
plugins: [
"transform-remove-strict-mode" //配置插件自赔,這里很重要
]
就解決了柳琢。
......
然鵝,
啟動項目npm run serve 報錯
Module build failed (from ./node_modules/_babel-loader@8.0.6@babel-loader/lib/index.js):
TypeError: this.setDynamic is not a function
原因:vue項目用的是最新的babel7版本,在.babel.config.js中使用的還是之前的插件.babel7之后的插件一般都是以@babel開頭的,下載新版的babel安裝包之后再運行就可以了
安裝改為
cnpm i @babel/plugin-transform-modules-commonjs @babel/plugin-transform-strict-mode -D
在babel.config.js中進行配置(vue-cli3 中 沒有.babelrc文件)
plugins: [
["@babel/plugin-transform-modules-commonjs", { "strictMode": false }]
],