I am using require.js for the first time, and everything works pretty well for now. However, I began to assemble the assembly. The idea is to create one file with all my js and templates. However, every time I use r.js, it just includes the dependencies of my main module.
here is my app.build.js:
({ appDir: "public/javascripts", baseUrl: ".", dir: "build", paths: { "hbs": "lib/hbs", "jquery": "lib/jquery", "Handlebars": "lib/Handlebars", "Backbone": "lib/backbone", "underscore": "lib/underscore", "bootstrap": "lib/bootstrap.min.js" }, modules: [{name: "main"}], shim: { "bootstrap": { deps: ["jquery"], exports: "$.fn.popover" }, underscore: { exports: '_' }, 'Handlebars': { exports: 'Handlebars' }, Backbone: { deps: ["underscore", "jquery"], exports: "Backbone" } }})
start of main.js:
require.config({ paths: { "hbs": "lib/hbs", "Handlebars": "lib/Handlebars", "Backbone": "lib/backbone", "underscore": "lib/underscore", "jquery": "lib/jquery", "bootstrap": "lib/bootstrap.min.js" }, hbs: { disableI18n: true }, shim: { "bootstrap": { deps: ["jquery"], exports: "$.fn.popover" }, underscore: { exports: '_' }, 'Handlebars': { exports: 'Handlebars' }, Backbone: { deps: ["underscore", "jquery"], exports: "Backbone" } } }); require(['jquery', 'Backbone', 'videos'], function($, Backbone, Videos) {
In this case, the final file created in my assembly 'main.js' contains only: jquery, underline, trunk and video. How can I make sure that it also includes the dependencies of the videos module, namely: the "hbs! Template / videos / show" template. How can I also make sure bootstrap.min.js is also added, although it is not needed anywhere? Finally, should you remove require.config as it will define paths that should not be larger since all modules are in the final file?