R.js 没有加载我的 shim,因此 jQuery 在 tinyMCE 之前加载,并且在加载之前初始化 tiny。我怎样才能让垫片工作?:
构建-js.js:
var requirejs = require('requirejs');
var config = {
mainConfigFile: '../js/main.js',
include: [],
name: 'main',
out: '../js/build/build.js',
};
requirejs.optimize(config, function (buildResponse) {
var contents = fs.readFileSync(config.out, 'utf8');
});
主.js:
require.config({
paths: {
jQuery: 'common/libs/jquery/jquery-min',
TinyMCE: 'common/libs/tinyMCE/tiny_mce',
},
shim: {
'jQuery': {
deps:['TinyMCE'],
exports: '$',
},
'jQueryUi': {
deps: ['jQuery']
},
'jQuerySelectmenu': {
deps: ['jQuery', 'jQueryUi']
},
'jQueryAutosize': {
depts: ['jQuery']
},
'Underscore': {
exports: '_'
},
'Backbone': {
deps: ['Underscore', 'jQuery'],
exports: 'Backbone'
}
}
});
require(['common/src/app'], function (App) {
App.initialize();
});