Uglify SyntaxError: Unexpected token: punc ())

前端 未结 8 960
甜味超标
甜味超标 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:57

    I am having the same issue, i found a great answers here that helped me to reach the the file that was causing the error.

    Go to Rails Console and Paste:

    JS_PATH = "app/assets/javascripts/**/*.js";
    Dir[JS_PATH].each do |file_name|
      puts "\n#{file_name}"
      puts Uglifier.compile(File.read(file_name))
    end
    

    Hope it helps someone!

    0 讨论(0)
  • 2020-12-01 08:00

    If you got this error using Grunt (grunt-contrib-uglify) the solution is to install ES6 version of the plugin:

    npm install grunt-contrib-uglify-es --save-dev
    
    0 讨论(0)
提交回复
热议问题