码迷,mamicode.com
首页 > 数据库 > 详细

Babel7.x完美解决严格模式报错:'caller', 'callee', and 'arguments' properties may not be accessed on strict mode

时间:2020-05-03 00:53:52      阅读:322      评论:0      收藏:0      [点我收藏+]

标签:span   bundle   nsf   com   ble   babel   描述   mod   方法   

问题描述

做项目用到了MUI的scroll控件 故此我引入了mui.min.js
然而 猝不及防地报错了:

错误信息:

‘caller‘, ‘callee‘, and ‘arguments‘ properties may not be accessed on strict mode functions or the arguments objects for calls to them
1
原因

mui.js用到了’caller’, ‘callee’, 和 ‘arguments’
但webpack打包好的bundle.js默认是启用严格模式(strict mode)的
在严格模式下 不能使用’caller’, ‘callee’, 和 ‘arguments’
因此 这两者起了冲突 从而报错

解决方法

安装babel-plugin-transform-remove-strice-mode插件的办法在老版本的Babel是可以的
npm install babel-plugin-transform-remove-strict-mode
或是npm install @babel/plugin-transform-strict-mode
但在新版本的Babel中没用 依旧会报错

解决方法其实很简单:

在.balelrc中添加排除项 排除你的mui.js即可

"ignore": [
      "./src/lib/mui/js/mui.min.js"
    ]
1
2
3
解决了strict mode的问题之后 可能还会有个不影响使用的报错:

错误信息:

[Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive.
1
虽说不影响使用 但不太美观 顺便解决一下吧
添加一个全局的样式即可:

* {
 touch-action: pan-y;
}
1
2
3
touch-action能够提高页面的流畅度(只有chrome支持)
pan-y样式的作用是启用单指垂直平移手势
即 单指在页面纵向滑动时 能提高页面的流畅度
————————————————
原文链接:https://blog.csdn.net/Piconjo/article/details/105880635

https://www.iqingren.com/User/9B2BC62D9101DD12.html

https://www.iqingren.com/User/BF6FF171E6347330.html

https://www.iqingren.com/User/DE64BCC3EFB05713.html

https://www.iqingren.com/User/C61B6C1CF85A53BE.html

https://www.iqingren.com/User/43CF2C9BBCC15720.html

 

Babel7.x完美解决严格模式报错:'caller', 'callee', and 'arguments' properties may not be accessed on strict mode

标签:span   bundle   nsf   com   ble   babel   描述   mod   方法   

原文地址:https://www.cnblogs.com/dasdfdfecvcx/p/12820198.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!