Skip to content
New issue

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

打包后注释警告还在 #31

Open
algesthesiah opened this issue Jul 13, 2018 · 1 comment
Open

打包后注释警告还在 #31

algesthesiah opened this issue Jul 13, 2018 · 1 comment

Comments

@algesthesiah
Copy link

请问怎么去除 使用
// new webpack.optimize.UglifyJsPlugin({
// comments: false, //去掉注释
// compress: {
// warnings: false //忽略警告,不然会有一大推的黄色字体出现
// }
// })
没作用

@Cap32
Copy link
Member

Cap32 commented Jul 13, 2018

会有一大推的黄色字体出现

不知道你说的黄色字体是什么

使用 babel-minify-webpack-plugin 会存在这个问题吗?

另外,一般像 Uglify 或 Babel Minify 之类的压缩工具,可以通过过滤 dead code 方式来实现删除代码

if (false) {
  console.log('blablabla');
}

这样的代码可以被压缩工具去掉。你可以通过 DefinePlugin 来把 __DEV__ 根据环境变量编译为 truefalse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants