Reputation: 1542
I have a grunt build that completes successfully and most libraries are available except for those dependent on other libraries.
For example, underscore-string depends on underscore and attaches itself to the underscore namespace as _.string but that function isn't available in the app. This is the same problem I have with moment.range.
{
"name": "app",
"dir": "client-compress",
"baseUrl": "client-dist",
"preserveLicenseComments": true,
"paths": {
"underscore": "bower_components/underscore/underscore",
"backbone": "bower_components/backbone/backbone-min",
"requireLib": "bower_components/requirejs/require",
"moment": "bower_components/moment/moment",
"string": "bower_components/underscore.string/lib/underscore.string",
"momentrange": "bower_components/moment-range/lib/moment-range"
...
},
"shim": {
"backbone": { "exports": "Backbone", "deps": ["underscore", "jquery"] },
"underscore": { "exports": "_" },
"string": { "deps": ["underscore"]},
"moment": {"exports": "moment"},
"momentrange": {"deps": ["moment"]}
...
},
"include": [
"requireLib",
"underscore",
"moment",
"string",
"backbone",
"momentrange"
...
]
}
The application works fine unoptimized and the string and range library are both included in the final build file. My guess is that the underscore and moment libraries are unavailable to attach to after the build file is loaded.
Upvotes: 1
Views: 523
Reputation: 1542
Solved it - underscore string needs to be included as "underscore.string" and not "string"
The config would then have a paths of
"paths": {
"underscore": "bower_components/underscore/underscore",
"backbone": "bower_components/backbone/backbone-min",
"requireLib": "bower_components/requirejs/require",
"moment": "bower_components/moment/moment",
"underscore.string": "bower_components/underscore.string/lib/underscore.string",
"momentrange": "bower_components/moment-range/lib/moment-range"
...
},
Upvotes: 1