Dave
unread,Jan 20, 2015, 4:19:37 PM1/20/15Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mimo...@googlegroups.com
Hello,
I'm trying to build a project and I want to optimize all my require modules into a single file, except for one. The one exclusion (called globals.js) will contain configuration parameters, so I want it to be separate and easily editable.
What is the correct way to do this? I tried using the exclude array in the require configuration in as many variations as I could think of, but I could not get it to work.
Now I'm trying using a 'modules' config, but I get an exception (copied at end below). Here's the config I have now (with various exclude permutations I tried commented out)
exports.config = {
minMimosaVersion:'2.0.0',
modules: [
"copy",
"less",
"require",
"requirebuild-include",
"requirebuild-textplugin-include"
],
watch: {
sourceDir: "source",
compiledDir: "distribution",
javascriptDir: "javascripts/app"
},
vendor: {
javascripts: "javascripts/lib"
},
copy: {
extensions: ["js","css","png","jpg","jpeg","gif","html","eot","svg","ttf","woff","otf","yaml","kml","ico","htc","htm","json","txt","xml","xsd","map","md","mp4","pdf"],
exclude: [
/jquery-ui\\development-bundle/,
/require\\r.js/,
/knockout\\.*debug.*/,
/font-awesome/
]
},
requireBuildTextPluginInclude: {
folder: '.',
pluginPath: 'text',
extensions: ['html']
},
requireBuildInclude: {
folder:"javascripts",
patterns: ['app/**/*.js', 'lib/durandal/**/*.js'],
exclude:['/-built.js$/','/reload-client.js$/']
},
require: {
// exclude : [/globals/],
// exclude : [/globals\.js/],
// exclude : ['globals'],
// exclude : ['globals.js'],
// exclude : ['distribution/javascripts/app/globals.js']
// exclude : ['./distribution/javascripts/app/globals.js'],
// exclude : ['source/javascripts/app/globals.js'],
// exclude : ['./source/javascripts/app/globals.js'],
optimize: {
modules: [
{
name: 'main',
include : [],
excludeShallow : ['globals']
},
{ name: 'globals',
include: []
}
],
overrides: {
mainConfigFile: "source/javascripts/app/main.js",
name: '../lib/require/almond-custom',
inlineText: true,
stubModules: ['text'],
pragmas: {
build: true
}
}
}
}
};
Exception with modules config:
C:\Dev\CVT\node_modules\mimosa-requirebuild-include\index.js:100
return runConfig.include.push(fileAMD);
^
TypeError: Cannot call method 'push' of undefined
at C:\Dev\CVT\node_modules\mimosa-requirebuild-include\index.js:100:34
at Array.forEach (native)
at C:\Dev\CVT\node_modules\mimosa-requirebuild-include\index.js:88:20
at Array.forEach (native)
at C:\Dev\CVT\node_modules\mimosa-requirebuild-include\index.js:60:47
at Array.forEach (native)
at Array._appendFilesToInclude [as 0] (C:\Dev\CVT\node_modules\mimosa-requirebuild-include\index.js:55:22)
Thanks for any help you can offer.