I am struggling with the requirejs optimizer. This code will work if I just load it in the browser without optimization. If I run the optimizer I get
: ENOENT, no such file or directory 'C:\Users\dev\checkout\src\main\webapp\resources\scripts\
json2.js'
In module tree: main
This is the code
requirejs.config({
paths : {
jquery : "lib/jquery",
bootstrap : "lib/bootstrap",
modals : "lib/modals",
tablesort : "lib/tablesort",
json2 : "lib/json2"
},
shim : {
"bootstrap" : [ "jquery" ],
"modals" : [ "jquery" ],
"tablesort" : [ "jquery" ],
"json2" : [ "jquery" ]
}
});
require([ "jquery", "json2","bootstrap", "modals", "tablesort", "registermodule", "personsmodule" ], function($) {
What needs to be done to get the optimizer working? I tried putting lib/json2 in the require. Then I get jQuery issues because it is non AMD modules.
Edit: still struggling with this one. Tried the simpliest example. Works fine in browser but the optimizer complains about not finding the files. lib/jquery.js and lib/modal.js.
requirejs.config({
paths : {
jquery : "lib/jquery",
modals : "lib/modals"
},
shim : {
"bootstrap" : [ "jquery" ],
"modals" : [ "jquery" ]
}
});
require([ "jquery", "modals" ], function($) {
console.log($("#leverandor_span").text());
$("#register_modal").modal("show");
});