我正在尝试缩小所有 js 文件(从控制器和 app.js 开始)。正如我们所知,由于模块声明约定,常规缩小器(uglify 等)不会直接在 angularjs 文件上工作。所以我尝试使用 ngmin。连接所有文件,然后尝试使用 ngmin - 但得到这个错误......
C:\Users\Rahul\AppData\Roaming\npm\node_modules\ngmin\node_modules\esprima\espri
ma.js:3872
throw e;
^
Error: Line 1007: Unexpected token *
at throwError (C:\Users\Rahul\AppData\Roaming\npm\node_modules\ngmin\node_mo
dules\esprima\esprima.js:1156:21)
at throwUnexpected (C:\Users\Rahul\AppData\Roaming\npm\node_modules\ngmin\no
de_modules\esprima\esprima.js:1213:9)
at parsePrimaryExpression (C:\Users\Rahul\AppData\Roaming\npm\node_modules\n
gmin\node_modules\esprima\esprima.js:1567:16)
at parseLeftHandSideExpressionAllowCall (C:\Users\Rahul\AppData\Roaming\npm\
node_modules\ngmin\node_modules\esprima\esprima.js:1644:61)
at parsePostfixExpression (C:\Users\Rahul\AppData\Roaming\npm\node_modules\n
gmin\node_modules\esprima\esprima.js:1703:20)
at parseUnaryExpression (C:\Users\Rahul\AppData\Roaming\npm\node_modules\ngm
in\node_modules\esprima\esprima.js:1784:16)
at parseMultiplicativeExpression (C:\Users\Rahul\AppData\Roaming\npm\node_mo
dules\ngmin\node_modules\esprima\esprima.js:1790:20)
at parseAdditiveExpression (C:\Users\Rahul\AppData\Roaming\npm\node_modules\
ngmin\node_modules\esprima\esprima.js:1807:20)
at parseShiftExpression (C:\Users\Rahul\AppData\Roaming\npm\node_modules\ngm
in\node_modules\esprima\esprima.js:1824:20)
at parseRelationalExpression (C:\Users\Rahul\AppData\Roaming\npm\node_module
s\ngmin\node_modules\esprima\esprima.js:1845:16)
我相信这个问题与在 Windows 环境中运行 ngmin 有关。我将用 Mac 再试一次 - 但试图判断是否有人遇到这个问题并能够找到任何解决方法?提前致谢 ...