2011-03-02 139 views
1

我正在使用RequireJS來組織我的JS文件。我正在嘗試優化我的文件到一個主要的JS文件。RequireJS優化參考錯誤

我使用下面的命令來做到這一點:

/home/plugins/requireJS/build/build.sh name=main out=mesh-built.js baseUrl=/home/public_html/js/ includeRequire=true 

的命令產生以下錯誤:

Tracing dependencies for: main 

node.js:116 
     throw e; // process.nextTick error, or 'error' event on first tick 
     ^
ReferenceError: $ is not defined 
    at eval at <anonymous> (/home/plugins/requireJS/bin/../build/jslib/requirePatch.js:147:21) 
    at Function.<anonymous> (eval at <anonymous> (/home/plugins/requireJS/bin/../build/jslib/requirePatch.js:147:21)) 
    at Function.load (/home/plugins/requireJS/bin/../build/jslib/requirePatch.js:147:21) 
    at loadPaused (require.js:916:21) 
    at require.js:958:21 
    at Object.completeLoad (require.js:1207:17) 
    at Function.load (/home/plugins/requireJS/bin/../build/jslib/requirePatch.js:150:29) 
    at loadPaused (require.js:916:21) 
    at require.js:958:21 
    at Object.completeLoad (require.js:1207:17) 

有誰知道爲什麼它會產生這個錯誤?

非常感謝。

回答

0

我認爲它是一個問題,包括文件的順序。確保首先包含定義$()的JS文件。