“Unexpected token: punc ())” when building for production

后端 未结 4 1653
再見小時候
再見小時候 2020-12-29 06:14

If I try to test-build my application with ng build --prod --aot I get the following, quite short, error message:

$ ng build --prod
                      


        
4条回答
  •  太阳男子
    2020-12-29 07:18

    I had the same problem and found out it was caused by https://www.npmjs.com/package/url-parameter-append

    There was an extra comma after a list of parameters in a function call

    I removed the comma in my own copy of url-parameter-append.js and then it worked.

    I reported the bug to the author of that package https://github.com/techinity/url-parameter-append/issues/10 , but really IMO the bug is

    • in the way angular build reports errors
    • in "Terser": an extra comma after a list of parameters is legit in js/ts.

提交回复
热议问题