在webpack4 中利用Babel 7取消严格模式方法

报错信息:webpack

Uncaught TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them

 

出现个个问题的缘由,是在引用mui中的mui.js文件时报的错误,因为在webpack中,采用的时严格模式,而mui.js用了非严格模式的写法。web

解决方法:1.把mui.js里面的内容改为严格模式,但这不可能,毕竟咱们要引用他们。npm

     2. 只能把webpack改成非严格模式了babel

 

安装:ui

cnpm i @babel/plugin-transform-modules-commonjs @babel/plugin-transform-strict-mode -D

 

在.babelrc中进行配置:spa

"plugins": [
      ["@babel/plugin-transform-modules-commonjs", { "strictMode": false }]
    ]

这样就解决了。0.0code

相关文章
相关标签/搜索