youzan / fast-uglifyjs-plugin

hight performance uglify plugin for webpack
71 stars 13 forks source link

ERROR in bundle-main.js from UglifyJs #5

Closed wv1124 closed 7 years ago

wv1124 commented 7 years ago

ERROR in bundle-main.js from UglifyJs undefined

keller35 commented 7 years ago

可以提供详细的error信息吗?

hihl commented 7 years ago

同样的问题, ERROR in add.chunk.js from UglifyJs undefined

sgwilym commented 7 years ago

I get the same error, and there is no detailed error information, even with debug: true. This error only happens for me if sourceMap is set to true.

keller35 commented 7 years ago

@sgwilym This issue may caused by sourceMap difference in webpack 1 and 2. Could you provide your webpack version?

lin-xin commented 7 years ago

@keller35 我是用vue-cli,然后使用你的这个插件,按照你的例子引入了插件,然后把我原先vue-cli的UglifyJsPlugin插件注释掉,build的时候出现了 ERROR in xxx.js from UglifyJs undefined image 请问你有没有用vue-cli的测试过,应该可以重现这个问题。

mshubin commented 7 years ago

Hi,

I had exactly the same issue and I succeded to resolve it by fixing the versions of following plugins:

Don't really know how it's related but it could be a possible workaround for someone and a hint for you to reproduce it.

My webpack version is 2.2.1.

Cheers,

keller35 commented 7 years ago

@lin-xin 我来复现一下,请问你用vue init的是哪个模板?

keller35 commented 7 years ago

@mshubin Hi,

Yes, it maybe related but it is difficult to find out the relation.

I prefer to rebuild this plugin from the built in plugin in webpack 2.

lin-xin commented 7 years ago

@keller35 vue init webpack xx

aui commented 7 years ago

这个 BUG 是两个问题导致的:

  1. webpack 1.x 没有锁定 uglify-js 版本号,开发者可能会更更新到 uglify-js@3.x 版本,这导致 API 不兼容而抛出异常
  2. fast-uglifyjs-plugin 错误处理逻辑有错误,导致父进程收到的错误消息为 undefined

PR: https://github.com/youzan/fast-uglifyjs-plugin/pull/7