问题: 用 webpack 打包文件,怎么移除严格模式
描述: 在项目中用了 MUI 前端框架,引入mui.js文件,并用 webpack 打包文件时,有如下报错:
Uncaught TypeError: ‘caller’, ‘callee’, and ‘arguments’ properties may not be accessed on
strict mode functions or the arguments objects for calls to them…
解决方法
- 下载两个插件
npm install @babel/plugin-transform-strict-mode -D
npm install @babel/plugin-transform-modules-commonjs -D
- 修改 .babelrc 文件
{
"plugins": [
["@babel/plugin-transform-modules-commonjs", { "strictMode": false }]
]
}
- 重启项目