vue-cli创建的项目中引入第三方库报错'caller', 'calle', and 'arguments' properties may not be...

时间:2023-03-08 23:30:03
vue-cli创建的项目中引入第三方库报错'caller', 'calle', and 'arguments' properties may not be...

本文链接:https://blog.csdn.net/Sophie_U/article/details/76223978

问题: 在vue的main.js中引入mui.min.js时,报错。

vue-cli创建的项目中引入第三方库报错'caller', 'calle', and 'arguments' properties may not be...

如上,单独在main.js或者任意组件中通过import 方式引入mui时都会报这个错。

原因:babel在将js文件转码为ES5时,默认使用严格模式,而在严格模式下,为了安全起见是不能用caller,callee,arguments等属性的。
解决:修改bablerc文件的配置,让项目忽略第三方js的转码。

vue-cli创建的项目中引入第三方库报错'caller', 'calle', and 'arguments' properties may not be...

 .babelrc文件:

vue-cli创建的项目中引入第三方库报错'caller', 'calle', and 'arguments' properties may not be...

此外,引入第三方库,如果设置了语法检查也会各种检查第三方js的语法错误。从而报错

通过修改eslintignor文件,将对应目录下的js忽略即可

vue-cli创建的项目中引入第三方库报错'caller', 'calle', and 'arguments' properties may not be...