2011-11-15 62 views

回答

10

這裏是上的node.js requireJS的使用在DOC

http://requirejs.org/docs/node.html

安裝的node.js

npm install requirejs 

使用例

var requirejs = require('requirejs'); 

requirejs(['foo', 'bar'], 
function (foo, bar) { 
    //foo and bar are loaded according to requirejs 
    //config, but if not found, then node's require 
    //is used to load the module. 
}); 
+0

這個答案包含了一些我認爲像我這樣的Node新手沒有意識到:你必須要求requirejs本身作爲一個單獨的對象!很有幫助。 –

相關問題