requirejs / almond

A minimal AMD API implementation for use after optimized builds
Other
2.42k stars 169 forks source link

"Uncaught ReferenceError: define is not defined " #90

Closed jonchay closed 10 years ago

jonchay commented 10 years ago

I'm trying to namespace my RequireJS like this:

require.config
  paths:
    underscore: "../../bower_components/lodash/dist/lodash.underscore"
    lodash: "../../bower_components/lodash/dist/lodash"
    template: "../../bower_components/lodash-template-loader/loader"
    jquery: "../../bower_components/jquery/dist/jquery"
    backbone: "../../bower_components/backbone/backbone"

  deps: ["main"]

  namespace: 'Foo'

With the namespace 'Foo', and going through the build, it seems to work by finding all define() or require() calls and replacing them. But one define() is not getting replaced in jQuery:

if ( typeof Foo.define === 'function' && Foo.define.amd ) {
  define( "jquery", [], function() {
    return jQuery;
  });
}

And thus the error Uncaught ReferenceError: define is not defined raised. How do I solve this?

jrburke commented 10 years ago

This sounds like jrburke/requirejs#1151, so I am going to mark this bug as a duplicate of that. For now, you could try using requirejs 2.1.11 to see if that works better. I will be looking at fixing the namespace bug for 2.1.15.