requirejs: {
compile: {
options: {
mainConfigFile: 'app/main.js',
name: 'main',
include: compileList, // A list of our widgets pulled in from other repos
// through bower
paths: {
'jquery': 'bower_components/jquery/jquery',
'jquery-ui': 'bower_components/jquery-ui-amd/jquery-ui-1.10.0/ui/minified/jquery-ui.min',
'bootstrap': 'bower_components/bootstrap/docs/assets/js/bootstrap.min',
'underscore': 'bower_components/underscore/underscore'
},
shim: {
'jquery-ui': {deps: ['jquery']},
'bootstrap': {deps: ['jquery', 'jquery-ui']},
'backbone': {
deps: ['jquery', 'underscore'],
exports: 'Backbone'
}
},
exclude: ['jquery', 'jquery-ui', 'bootstrap'],
insertRequire: ['main'],
out: 'dist/<%= pkg.name %>.js'
}
}
}
When I try to load my page I keep getting the error
Module name "underscore" has not been loaded yet for context: _. Use require([]) but this doesn't happen when I run the un-compiled version of our app.
I had to exclude jquery, jquery-ui and bootstrap because those were throwing other errors (it kept telling me jQuery is not defined).
I'm sure I'm just not setting some option correctly. I've been fiddling with the shim, insertRequire and keepAmdefine but I can't get the underscore error to resolve.
Here is my requirejs task:
When I try to load my page I keep getting the error
Module name "underscore" has not been loaded yet for context: _. Use require([])
but this doesn't happen when I run the un-compiled version of our app.I had to exclude jquery, jquery-ui and bootstrap because those were throwing other errors (it kept telling me
jQuery is not defined
).I'm sure I'm just not setting some option correctly. I've been fiddling with the shim, insertRequire and keepAmdefine but I can't get the underscore error to resolve.