在實際項目中,有些組件不符合AMD規范該如何,此時需要使用shim參數來進行相應配置
example
//people模塊 people.js
;(function(){
function People(){
}
People.prototype = {}
window.people = People;
})()
require.config({
paths: {
'people': 'control/people.js'
},
shim:{
'people':{
deps: ['jquery'],
exports: 'p'
}
}
})
require(['people'],function(){
new p()
})