2016-12-01 63 views
0

試圖上傳至銀河編譯當流星UglifyJS錯誤導致的錯誤,所以我與調試以下內容:試圖生產

meteor --settings settings-dev.json --production

While minifying app code: 
    eval at <anonymous> 
    (/Users/sergiy/.meteor/packages/standard-minifier-js/.1.2.1.1ldi2wj++os+web.browser+web.cordova/plugin.minifyStdJS.os/npm/node_modules/meteor/minifier-js/node_modules/uglify-js/tools/node.js:28:1), 
    <anonymous>:1545:18: SyntaxError: Unexpected token: punc()) 
    at new JS_Parse_Error (eval at <anonymous> 
    (/Users/sergiy/.meteor/packages/standard-minifier-js/.1.2.1.1ldi2wj++os+web.browser+web.cordova/plugin.minifyStdJS.os/npm/node_modules/meteor/minifier-js/node_modules/uglify-js/tools/node.js:28:1), 
    <anonymous>:1545:18) 
    at js_error (eval at <anonymous> 
    (/Users/sergiy/.meteor/packages/standard-minifier-js/.1.2.1.1ldi2wj++os+web.browser+web.cordova/plugin.minifyStdJS.os/npm/node_modules/meteor/minifier-js/node_modules/uglify-js/tools/node.js:28:1), 
    <anonymous>:1553:11) 
    at croak (eval at <anonymous> 
    (/Users/sergiy/.meteor/packages/standard-minifier-js/.1.2.1.1ldi2wj++os+web.browser+web.cordova/plugin.minifyStdJS.os/npm/node_modules/meteor/minifier-js/node_modules/uglify-js/tools/node.js:28:1), 
    <anonymous>:2089:9) 
    at token_error (eval at <anonymous> 
    (/Users/sergiy/.meteor/packages/standard-minifier-js/.1.2.1.1ldi2wj++os+web.browser+web.cordova/plugin.minifyStdJS.os/npm/node_modules/meteor/minifier-js/node_modules/uglify-js/tools/node.js:28:1), 
    <anonymous>:2097:9) 
    at unexpected (eval at <anonymous> 
    (/Users/sergiy/.meteor/packages/standard-minifier-js/.1.2.1.1ldi2wj++os+web.browser+web.cordova/plugin.minifyStdJS.os/npm/node_modules/meteor/minifier-js/node_modules/uglify-js/tools/node.js:28:1), 
    <anonymous>:2103:9) 
    at expr_atom (eval at <anonymous> 
    (/Users/sergiy/.meteor/packages/standard-minifier-js/.1.2.1.1ldi2wj++os+web.browser+web.cordova/plugin.minifyStdJS.os/npm/node_modules/meteor/minifier-js/node_modules/uglify-js/tools/node.js:28:1), 
    <anonymous>:2618:13) 
    at maybe_unary (eval at <anonymous> 
    (/Users/sergiy/.meteor/packages/standard-minifier-js/.1.2.1.1ldi2wj++os+web.browser+web.cordova/plugin.minifyStdJS.os/npm/node_modules/meteor/minifier-js/node_modules/uglify-js/tools/node.js:28:1), 
    <anonymous>:2792:19) 
    at expr_ops (eval at <anonymous> 
    (/Users/sergiy/.meteor/packages/standard-minifier-js/.1.2.1.1ldi2wj++os+web.browser+web.cordova/plugin.minifyStdJS.os/npm/node_modules/meteor/minifier-js/node_modules/uglify-js/tools/node.js:28:1), 
    <anonymous>:2827:24) 
    at maybe_conditional (eval at <anonymous> 
    (/Users/sergiy/.meteor/packages/standard-minifier-js/.1.2.1.1ldi2wj++os+web.browser+web.cordova/plugin.minifyStdJS.os/npm/node_modules/meteor/minifier-js/node_modules/uglify-js/tools/node.js:28:1), 
    <anonymous>:2832:20) 


    * Many more lines of same kind of stuff* 


=> Your application has errors. Waiting for file change. 

這真的讓我沒有起點,以什麼造成問題。 GitHub上有一個running issue,但目前還沒有進展。

我試圖深入挖掘,做在我的終端

alias uglifyjs=~/.meteor/packages/standard-minifier-js/.1.2.1.1ldi2wj++os+web.browser+web.cordova/plugin.minifyStdJS.os/npm/node_modules/meteor/minifier-js/node_modules/uglify-js/bin/uglifyjs 
find lib client -type f -name \*.js|while read file;do uglifyjs -o /dev/null $file;done 

Parse error at client/main.js:1,7 
    SyntaxError: Unexpected token: string (/imports/startup/client) 
    Error 
    at new JS_Parse_Error (eval at <anonymous> (/Users/sergiy/.meteor/packages/standard-minifier-js/.1.2.1.1ldi2wj++os+web.browser+web.cordova/plugin.minifyStdJS.os/npm/node_modules/meteor/minifier-js/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:1545:18) 
    at js_error (eval at <anonymous> (/Users/sergiy/.meteor/packages/standard-minifier-js/.1.2.1.1ldi2wj++os+web.browser+web.cordova/plugin.minifyStdJS.os/npm/node_modules/meteor/minifier-js/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:1553:11) 
    at croak (eval at <anonymous> (/Users/sergiy/.meteor/packages/standard-minifier-js/.1.2.1.1ldi2wj++os+web.browser+web.cordova/plugin.minifyStdJS.os/npm/node_modules/meteor/minifier-js/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2089:9) 
    at token_error (eval at <anonymous> (/Users/sergiy/.meteor/packages/standard-minifier-js/.1.2.1.1ldi2wj++os+web.browser+web.cordova/plugin.minifyStdJS.os/npm/node_modules/meteor/minifier-js/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2097:9) 
    at unexpected (eval at <anonymous> (/Users/sergiy/.meteor/packages/standard-minifier-js/.1.2.1.1ldi2wj++os+web.browser+web.cordova/plugin.minifyStdJS.os/npm/node_modules/meteor/minifier-js/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2103:9) 
    at semicolon (eval at <anonymous> (/Users/sergiy/.meteor/packages/standard-minifier-js/.1.2.1.1ldi2wj++os+web.browser+web.cordova/plugin.minifyStdJS.os/npm/node_modules/meteor/minifier-js/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2123:56) 
    at simple_statement (eval at <anonymous> (/Users/sergiy/.meteor/packages/standard-minifier-js/.1.2.1.1ldi2wj++os+web.browser+web.cordova/plugin.minifyStdJS.os/npm/node_modules/meteor/minifier-js/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2314:73) 
    at eval (eval at <anonymous> (/Users/sergiy/.meteor/packages/standard-minifier-js/.1.2.1.1ldi2wj++os+web.browser+web.cordova/plugin.minifyStdJS.os/npm/node_modules/meteor/minifier-js/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2183:19) 
    at eval (eval at <anonymous> (/Users/sergiy/.meteor/packages/standard-minifier-js/.1.2.1.1ldi2wj++os+web.browser+web.cordova/plugin.minifyStdJS.os/npm/node_modules/meteor/minifier-js/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2136:24) 
    at eval (eval at <anonymous> (/Users/sergiy/.meteor/packages/standard-minifier-js/.1.2.1.1ldi2wj++os+web.browser+web.cordova/plugin.minifyStdJS.os/npm/node_modules/meteor/minifier-js/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2904:23) 

main.js文件回來以下是這樣的:

import '/imports/startup/client';

自從t以來仍然無法弄清楚問題是什麼帽子是流星在他們的文檔中建議的語法。刪除standard-minifier-js包可解決問題,但這不是解決問題的最佳方式,所以我希望有一個解決方案!

+0

您是否在項目中包含ecmascript或babel包? – Mikkel

+0

您的應用程序是否在沒有'--production'的情況下運行? – Khang

+0

@Khang,是的,這是因爲'standard-minifiers-js'軟件包只能在生產捆綁中使用,例如部署到Galaxy或使用'--production'運行 – sdybskiy

回答

0

原因是NPM軟件包存在問題(ClipboardJS)我正在導入其中一個組件。刪除它並將腳本添加到我的<head></head>解決了問題。我寧願有一個縮小的應用程序與外部src比非縮小的應用程序。

0

UglifyJS穩定但沒有和諧的支持,但截至2.7.5。

https://github.com/mishoo/UglifyJS2雖然有一個和諧和諧-v2.7.5分支。儘管許多功能已經實現,但對於目前還沒有完全實現的模塊的支持仍然存在,並且和諧支持仍然是實驗性的。

+0

我將如何在整個應用程序範圍內實現它以模仿'standard-minifiers-js'? – sdybskiy

+0

uglifyJS和諧可以穩定發佈之前還有一些工作要做。即使那些取決於uglifyJS的人可能想要使用和諧分支,我認爲它是不值得的,即使該分支可能對es5.1功能至少穩定(通過我們的測試來衡量,儘管可能存在不穩定性)。 而且也沒有簡單的方法來實現它,除了改變package.json使其引用一個和諧的github分支或提交url。 – avdg