Uglify SyntaxError: Unexpected token: punc ())

前端 未结 8 995
甜味超标
甜味超标 2020-12-01 07:28

I am trying to use gulp in order to minify a folder containing JS files. However, one of the files has the above error, preventing it from being minified.

I managed

8条回答
  •  青春惊慌失措
    2020-12-01 07:40

    For me it had nothing to do with Uglify not working correctly, but rather a dependency (in this case empty-promise) that has not been compiled to ES5 yet. As we just imported the raw source file, but babel is only transpiling files outside of node_modules, uglify got confused by the ES6 syntax.

    Simply check if any dependency you've recently added might not have a "dist" build.

提交回复
热议问题