AMD problem when upgrading from 0.10.0 to 1.0.1 #214

Closed
dueckes opened this Issue Mar 21, 2013 · 3 comments

Comments

3 participants

dueckes commented Mar 21, 2013

After upgrading, my 'require' statements are not defining '_', for example:

require.config({
  paths: {
    underscore: "/my/path/to/lodash.underscore-1.0.1.min"
  }
});

require(["x", "y", "underscore"]), function(x, y, _) {
  // '_' is undefined
});

Has there been a change effecting AMD support in the underscore compatibility builds (intentional or otherwise)?

Note: I am seeing this with both the development and production underscore compatibility builds.

Contributor

terinjokes commented Mar 21, 2013

AMD isn't supported in Underscore, so Lo-Dash doesn't add it in the default underscore build.

You can do a custom underscore build and add exports="amd" to add the AMD support back in.

dueckes commented Mar 21, 2013

Thanks for the quick response.

Interestingly I was recommended lodash as a drop-in replacement for underscore due to it's AMD support.

Owner

jdalton commented Mar 22, 2013

Early on, before Lo-Dash v1.0.0, we stayed very close to Underscore. As time went on we had API changes, for the better I believe, that broke lock-step Underscore compat. To ensure the highest compat the default lodash.underscore.js follows Underscore very closely (meaning no AMD support). However, devs can easily create their own custom version that has Underscore compat plus any extra Lo-Dash addons. For AMD along with the other export options you could do npm install -g lodash then lodash underscore exports=amd,global,commonjs,node.

That said, this isn't the first time someone wanted the lodash underscore build to have AMD support by default. I will tweak the dist/ build to include it as I don't think it will be a compat pain point.

@jdalton jdalton closed this in c210dab Mar 23, 2013

jdalton added a commit that referenced this issue Aug 29, 2013

Add AMD exports to the dist/lodash.underscore.js builds. [closes #214]
Former-commit-id: 4635d0c4f1ff315b08fb459ab64ef2b9ac6cbaa8

jdalton added a commit that referenced this issue Sep 1, 2013

Add AMD exports to the dist/lodash.underscore.js builds. [closes #214]
Former-commit-id: 4635d0c4f1ff315b08fb459ab64ef2b9ac6cbaa8

jdalton added a commit that referenced this issue Sep 25, 2014

Add AMD exports to the dist/lodash.underscore.js builds. [closes #214]
Former-commit-id: 4635d0c4f1ff315b08fb459ab64ef2b9ac6cbaa8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment