webpack打包压缩时命令行报错(avalon2)

发布于 2022-09-03 14:27:31 字数 3421 浏览 41 评论 0

webpack打包压缩时,报错关于avalon2

命令行运行 webpack -p(webpack打包、压缩css js 文件命令)后:


cMacBook-Air:cmyWorks WZJS-CMY$ webpack -p
clean-webpack-plugin: /Users/chenmeiyuan1/Documents/quanTong/qky-xyzk-frontend/cmyWorks/dist has been removed.
Hash: ff4916f755c1312d69b6
Version: webpack 1.13.1
Time: 6068ms
                          Asset       Size  Chunks             Chunk Names
  js/index2016y7m15d8h57m795.js     199 kB       0  [emitted]  index
css/index2016y7m15d8h57m795.css    1.08 MB       0  [emitted]  index
              ./html/index.html  933 bytes          [emitted]  
   [0] ./dev/js/webpack/index.js 169 bytes {0} [built]
   [1] ./dev/js/common/public.js 189 bytes {0} [built]
   [2] ./dev/js/json/findLimitFruits.js 503 bytes {0} [built]
   [3] ./dev/js/json/findLimitPractices.js 521 bytes {0} [built]
   [4] ./dev/js/json/indexjson.js 951 bytes {0} [built]
   [5] ./dev/js/webpack/common.js 84 bytes {0} [built]
    + 13 hidden modules

WARNING in js/index2016y7m15d8h57m795.js from UglifyJs
Condition always true [./~/avalon2/dist/avalon.js:10,0]
Dropping unreachable code [./~/avalon2/dist/avalon.js:12,0]
Side effects in initialization of unused variable eventCache [./~/avalon2/dist/avalon.js:3931,0]
Side effects in initialization of unused variable markID [./~/avalon2/dist/avalon.js:3933,0]
Dropping unused variable rfilters [./~/avalon2/dist/avalon.js:3935,0]
Dropping unused variable rfilters [./~/avalon2/dist/avalon.js:3939,0]
Dropping unused variable rvar [./~/avalon2/dist/avalon.js:3940,0]
Dropping unused variable rstring [./~/avalon2/dist/avalon.js:3941,0]
Dropping unused variable domTemplate [./~/avalon2/dist/avalon.js:5341,0]
Dropping unused function isEmptyObject [./~/avalon2/dist/avalon.js:5402,0]
Side effects in initialization of unused variable stringify [./~/avalon2/dist/avalon.js:5125,0]
Side effects in initialization of unused variable a [./~/avalon2/dist/avalon.js:6318,0]
Dropping unused variable emptyArr [./~/avalon2/dist/avalon.js:6859,0]
Condition always true [./~/jquery/dist/jquery.js:10972,0]
Child html-webpack-plugin for "html/index.html":
        + 3 hidden modules
Child extract-text-webpack-plugin:
        + 6 hidden modules

报错代码为:

WARNING in js/index2016y7m15d8h57m795.js from UglifyJs
Condition always true [./~/avalon2/dist/avalon.js:10,0]
Dropping unreachable code [./~/avalon2/dist/avalon.js:12,0]
Side effects in initialization of unused variable eventCache [./~/avalon2/dist/avalon.js:3931,0]
Side effects in initialization of unused variable markID [./~/avalon2/dist/avalon.js:3933,0]
Dropping unused variable rfilters [./~/avalon2/dist/avalon.js:3935,0]
Dropping unused variable rfilters [./~/avalon2/dist/avalon.js:3939,0]
Dropping unused variable rvar [./~/avalon2/dist/avalon.js:3940,0]
Dropping unused variable rstring [./~/avalon2/dist/avalon.js:3941,0]
Dropping unused variable domTemplate [./~/avalon2/dist/avalon.js:5341,0]
Dropping unused function isEmptyObject [./~/avalon2/dist/avalon.js:5402,0]
Side effects in initialization of unused variable stringify [./~/avalon2/dist/avalon.js:5125,0]
Side effects in initialization of unused variable a [./~/avalon2/dist/avalon.js:6318,0]
Dropping unused variable emptyArr [./~/avalon2/dist/avalon.js:6859,0]
Condition always true [./~/jquery/dist/jquery.js:10972,0]

好像大部分的错误都在avalon2这个文件里?

我是通过npm install avalon2命令安装avalon2的。

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

盛装女皇 2022-09-10 14:27:31

UglifyJs会分析JS代码,自动删除里面一些用不着的代码,比如声明而不用的变量(Dropping unused variable)、恒为TRUE的if语句(Condition always true)、return语句后的代码(Dropping unreachable code),以达到缩减JS尺寸的效果。不影响后续JS执行的,因此不必刻意在意这些WARNING。

魔法唧唧 2022-09-10 14:27:31

你这样无法调试啊?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文