2012-07-27 56 views
3

我們已經有一個使用require.js的AMD實現,這個實現已經使用了很長時間,現在團隊已經決定使用r.js優化器來優化構建。我下面的步驟,但我想我失去了一些東西:require.js找不到jquery.js

我們有require.config看起來像下面這樣:

require.config({ 
    waitSeconds : 15, 
    baseUrl: window.rootPath + 'scripts', 
    paths: { 
     jquery: 'empty:', 
     jqueryui: 'empty:', 
     recaptcha: '//www.google.com/recaptcha/api/js/recaptcha_ajax', 
     maxmind: '//j.maxmind.com/app/geoip', 
     enduser: '/enduser/scripts/system', 
     cookies: '/enduser/scripts/system/cookies', 
     errorhandler: '/enduser/scripts/system/errorhandler', 
     underscore: '/enduser/scripts/underscore', 
     blockui: '/enduser/scripts/jquery.blockui', 
     messaging: '/enduser/scripts/system/messaging', 
     jgrowl: '/enduser/scripts/jquery.jgrowl', 
     knockout: 'knockout-latest.debug', 
     kobindings: '/enduser/scripts/system/bindings', 
     async: 'plugins/require/async', 
     depend: 'plugins/require/depend', 
     font: 'plugins/require/font', 
     goog: 'plugins/require/goog', 
     image: 'plugins/require/image', 
     json: 'plugins/require/json', 
     noext: 'plugins/require/noext', 
     mdown: 'plugins/require/mdown', 
     propertyParser: 'plugins/require/propertyParser', 
     markdownConverter: 'lib/Markdown.Converter' 
    }, 
    priority: ['jquery'] 
}); 

require(["main"]); 

請注意,它有CDN路徑,而不是「空」。但是我在線閱讀了一些主題後,在那裏空着。我上運行以下命令:

node -o name="filepath" output="output file path" 

它的說法跟蹤依賴關係,然後它拋出一個錯誤說沒有發現的jquery.js。有什麼建議麼?

+0

基本上,這個解決方案是包含paths.jquery = empty:在命令的末尾。所以我的命令看起來像'node -o name =「filepath」output =「輸出文件路徑」paths.jquery = empty:'。這也適用於您正在使用的任何CDN,包括Jquery。 – TeaLeave 2012-07-27 18:15:25

回答

3

基本上,解決方案是在命令的末尾加入paths.jquery = empty:。所以我的命令看起來像節點-o name =「filepath」output =「輸出文件路徑」paths.jquery = empty :.這也適用於您正在使用的任何CDN,包括Jquery。