I'm trying to build a requirejs/backbone/handlebars project, and I seem to be coming accross this error when I try run the app.build.js:
Tracing dependencies for: main
ReferenceError: _ is not defined
In module tree:
main
cs
hbs
underscore
ReferenceError: _ is not defined
In module tree:
main
cs
hbs
underscore
at Object.eval (eval at <anonymous> (/usr/local/share/npm/lib/node_modules/requirejs/bin/r.js:13718:64))
The app works perfectly in and without errors when not built. The project has backbone and underscore included as requirejs shims if it matters. I would post the whole source, but it is an internal system, so I can't. If more info is needed, I can post it.
Thanks!
I had the same problem and this worked for me -
Remove underscore from your RequireJS shim.
Then at the bottom of your underscore.js file, just above the closing brackets and call statement, add a define statement to properly export _
define(function(){
return _;
});
}).call(this);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With