uglify js error unexpected token eof “undefined”

后端 未结 5 2065
时光取名叫无心
时光取名叫无心 2021-01-18 07:36

So I installed npm using npm install uglify-js

I run a command which is:

cat file1.js file2.js .. fileN.js | uglifyjs -o files.min.js
相关标签:
5条回答
  • 2021-01-18 08:03

    Also faced this same issue. However, in my case, I could open the file with a problem and save it and then uglify would run without any issues.

    Documented here

    Workaround: I added a lineending task before invoking uglify to explicitly convert the line endings. Now uglify runs without issues.

    0 讨论(0)
  • 2021-01-18 08:09

    In my case I had forgotten to close some open functions in my javascript. Make sure you have all of your semicolons properly closed too.

    0 讨论(0)
  • 2021-01-18 08:19

    ERROR: Unexpected token eof «undefined», expected punc «,» [-:630,15]

    I believe all it means is that you are missing a , somewhere in your JS code, possibly on line 630, near character 15.

    So if you concatenate the source of all your JS files, and take a look at line 630, you might find where the parser thought there was a missing comma.

    0 讨论(0)
  • 2021-01-18 08:23

    This could also be because of a bug in UglifyJS when reading from stdin. See https://github.com/mishoo/UglifyJS2/issues/85 for details.

    0 讨论(0)
  • 2021-01-18 08:25

    I got this same error with ember:

    Build Error (UglifyWriter)
    Unexpected token: eof (undefined)
    

    The solution was to update ember-cli-moment-shim to version v3.8.0

    0 讨论(0)
提交回复
热议问题