Optimizer RequireJS configuration issues, bbb release

I use RequireJS, a basic template with a layout manager, JamJS to help manage packages, and everything works fine in development, but when I try to create a production version with concatenated files, it does not work.

It seems that shim in my configuration may not load. For example, the error I get in my console is Uncaught TypeError: Cannot set property 'cookie' of undefined , so jQuery does not load as a dependency for jquery.cookie. Here is my config application:

 // Set the require.js configuration for your application. require.config({ // Initialize the application with the main application file and the JamJS // generated configuration file. deps: ["../vendor/jam/require.config", "main"], paths: { baseUrl : '/', config : "config", // JavaScript folders. api : "libs/api", app : "app", // Libraries. almond : "../vendor/jam/js/libs/almond", engagement : "libs/engagement", environment : "libs/environment", jquery : "../vendor/jam/jquery/jquery", jqueryui : "../vendor/js/libs/jquery-ui-1.9.1.custom.min", "jquery-cookie" : "../vendor/jam/jquery-cookie/jquery.cookie", chosen : "../vendor/js/libs/jquery.chosen.min", colorpicker : "../vendor/js/libs/jquery.colorpicker", bootstrap : "../vendor/js/libs/bootstrap", jqueryuiwidget : "../vendor/js/libs/jquery.ui.widget", jstemplates : "../vendor/js/libs/tmpl", jsloadimage : "../vendor/js/libs/load-image", jscanvastoblob : "../vendor/js/libs/canvas-to-blob", iframetransport : "../vendor/js/libs/jquery.iframe-transport", fileupload : "../vendor/js/libs/jquery.fileupload", fileuploadfp : "../vendor/js/libs/jquery.fileupload-fp", fileuploadui : "../vendor/js/libs/jquery.fileupload-ui", fileuploadlib : "libs/fileupload", highchartsgraytheme : "../vendor/js/libs/gray", highchartsexporter : "../vendor/js/libs/exporting", adpin : "libs/adpin", val : "../vendor/js/libs/jquery.validate.min", valmethods : "../vendor/js/libs/additional-methods.min", advertiser : "libs/advertiser", messages : "libs/messages", user : "libs/user", zeroclipboard : "../vendor/js/libs/zero-clipboard", jqgrid : "../vendor/js/libs/jquery.jqGrid.min", jqgridsource : "../vendor/js/libs/grid.locale-en", reporting : "libs/reporting", adlift : "libs/adlift", utilities : "libs/utilities", qrcode : "../vendor/js/libs/jquery.qrcode.min", base64 : "../vendor/js/libs/base64", kinetic : "../vendor/js/libs/kinetic.min", canvaslib : "libs/canvas", socialstream : "libs/socialstream", analytics : "libs/analytics", classie : "../vendor/js/libs/classie", classie_modernizr : "../vendor/js/libs/modernizr.custom", qtip2 : "../vendor/js/libs/jquery.qtip", sponsored : 'libs/sponsoredcontent', publisher : 'libs/publisher', xml : '../vendor/jam/codemirror3/mode/xml/xml' }, shim: { "jquery-cookie" : { deps : ["jquery"] }, "api" : { deps : ["environment"] }, "xml" : { deps : ["codemirror3"] }, "classie" : { deps : ["classie_modernizr"] }, "jqueryui" : { deps : ["jquery"] }, "colorpicker":{ deps : ["jquery"] }, "jqueryuiwidget" : { deps : ["jquery"] }, "jstemplates" : { deps : ["jquery"] }, "jsloadimage" : { deps : ["jquery"] }, "jscanvastoblob" : { deps : ["jquery"] }, "fileupload" : { deps : ["jquery", "jqueryuiwidget"] }, "fileuploadfp" : { deps : ["jquery", "jscanvastoblob", "fileupload"] }, "fileuploadui" : { deps : ["jquery", "jstemplates", "jsloadimage", "fileuploadfp", "fileuploadlib"] }, "qrcode" : { deps : ["jquery"] }, "base64" : { deps : ["jquery"] }, "highchartsgraytheme" : { deps : ["highcharts"] }, "highchartsexporter" : { deps : ["highcharts"] }, "utilities" : { deps : ["lodash", "jquery", "val"] }, "val" : { deps : ["jquery"] }, "valmethods" : { deps: ["jquery", "val"] }, "zeroclipboard": { deps : ["jquery"] }, "jqgrid" : { deps : ["jquery", "jqgridsource"] }, "jqgridsource" : { deps : ["jquery"] }, "bootstrap" : { deps : ["jquery"] } } }); 

This is how I upload my require.js file:

 <script data-main="/app/config" src="/dist/debug/require.js"></script> 

Any ideas on what could happen? When I use bbb release , everything fails without error to create this debug file.

+8
javascript jquery requirejs backbone-boilerplate backbone-layout-manager
source share
2 answers

I have some suggestions, this might seem silly, but since I have no hands, guessing the file is the best I can do, so make sure your jquery cookie does not have: define(["jquery"], ..... file, because you must either include it in the gasket, or with this definition, but not, because it can cause a conflict.if this worked, let me know to add an explanation of why this happened, good luck.

+3
source share

Evan, I don’t know exactly what the problem is. I would recommend leaving JamJS in favor of Bower for this. Who knows, maybe the assembly in Jam is ruined.

Your gasket looks correct, but I wonder if the mainConfigFile option is mainConfigFile in the Gruntfile.js file in the requirejs section.

The bbb team is out of date, so I would advise you to research https://github.com/backbone-boilerplate/backbone-boilerplate/wiki/Installation our generator should satisfy your needs!

+2
source share

All Articles