We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
这个问题产生的原因是因为IE不支持console语法,如果语句中有console,只有在控制台打开的时候才会执行代码。
有两种解决方案:
方案1 对于使用webpack打包的项目,处理起来就比较简单了,在webpack.conf.js 中,uglifyjsPlugin插件中添加配置项:
uglifyOptions: { compress: { drop_console:true } }
这样打包之后就会自动删除所有的console;
方案2
在页面头部添加代码,对console进行判断,是否识别:
<script type="text/javascript"> if(!window.console){ window.console = {}; } if (!window.console.log) { window.console.log = function(mes){ }; } </script>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
原因
这个问题产生的原因是因为IE不支持console语法,如果语句中有console,只有在控制台打开的时候才会执行代码。
解决方案
有两种解决方案:
方案1
对于使用webpack打包的项目,处理起来就比较简单了,在webpack.conf.js 中,uglifyjsPlugin插件中添加配置项:
这样打包之后就会自动删除所有的console;
方案2
在页面头部添加代码,对console进行判断,是否识别:
The text was updated successfully, but these errors were encountered: