Using Durandal's optimization companion Weyland, we can combine all .js and .html files into main-built.js and skip RequireJS by using Almond. We do this as described in the docs:
http://durandaljs.com/documentation/Weyland.html and
http://durandaljs.com/documentation/Automating-Builds-with-Visual-Studio.html
(Yes it is an ASP.NET MVC project)
However we are seeing main-built.js growing larger and larger.
What are the considerations for Weyland? Can we approach this differently? Should we approach this differently? If our project grows, so does the main-built file. Startup load will then increase and maybe not all users need download the entire project (security wise users are cut of from different areas).
Hope someone can shed some light on this?
Current Weyland config:
exports.config = function (weyland) {
weyland.build('main')
.task.jshint({
include: 'App/**/*.js'
})
.task.uglifyjs({
include: ['App/**/*.js', 'Scripts/durandal/**/*.js']
})
.task.rjs({
include: ['App/**/*.{js,html}', 'Scripts/durandal/**/*.js'],
loaderPluginExtensionMaps: {
'.html': 'text'
},
rjs: {
name: '../Scripts/almond-custom.min', //to deploy with require.js, use the build's name here instead
insertRequire: ['main'], //not needed for require
baseUrl: 'App',
wrap: true, //not needed for require
paths: {
'text': '../Scripts/text',
'durandal': '../Scripts/durandal',
'plugins': '../Scripts/durandal/plugins',
'transitions': '../Scripts/durandal/transitions',
'knockout': 'empty:',
'bootstrap': 'empty:',
'jquery': 'empty:',
'i18next': '../Scripts/i18next.amd.withJQuery-1.7.2.min'
},
inlineText: true,
//optimize: 'uglify2',
optimize: 'none',
pragmas: {
build: true
},
stubModules: ['text'],
keepBuildDir: true,
out: 'App/main-built.js'
}
});
}