bundle.js:31234 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 中的 tab-top-webview-main.html
- 滑动条无法正常触发滑动,通过检查官方文档,发现这是JS组件,需要被初始化一下:
- 导入 mui.js
- 调用官方提供的 方式 去初始化:
mui('.mui-scroll-wrapper').scroll({
deceleration: 0.0005 //flick 减速系数,系数越大,滚动速度越慢,滚动距离越小,默认值0.0006
});
- 我们在初始化 滑动条 的时候,导入的 mui.js ,但是,控制台报错:
Uncaught TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode
-
经过我们合理的推测,觉得,可能是 mui.js 中用到了 ‘caller’, ‘callee’, and ‘arguments’ 东西,但是, webpack 打包好的 bundle.js 中,默认是启用严格模式的,所以,这两者冲突了;
-
关闭严格模式,参考GitHub文档 https://github.com/genify/babel-plugin-transform-remove-strict-mode