CommonJs and AMD
1:the first difference is async 。the CommonJs begin to exec the code when the source loaded at the same time!eg: var a = require('./a');console.log('a',a)。However,AMD rules begin to exec the code when the source loaded !eg: define(require,module,expore){ }
2:the CommonJs is fit for Nodejs ,as the scoure is in the local disck ,But the AMD is suit to Explore Project ,just like Html5 。(seajs is AMD )
3:require supply the main、cache、extensions、resolve ,it also can anysc exec function by ensure。
CommonJs and AMD 1:the first difference is async 。the CommonJs begin to exec the code when the source loaded at the same time!eg: var a = require('./a');console.log('a',a)。However,AMD rules begin to exec the code when the source loaded !eg: define(require,module,expore){ } 2:the CommonJs is fit for Nodejs ,as the scoure is in the local disck ,But the AMD is suit to Explore Project ,just like Html5 。(seajs is AMD ) 3:require supply the main、cache、extensions、resolve ,it also can anysc exec function by ensure。