R.js is not loading my shim, and thus jQuery is loading before tinyMCE and tiny is being initialized before it has loaded. How can I get the shim to work?:
build-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');
});
main.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();
});
This issue is already fixed at r.js
2.1.11
just place
wrapShim: true
in the build config.
github issue
configuration example
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With