Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using lodash's wrap method is prevented in grunt because of underscore.string #26

Closed
mazesoul opened this issue Mar 29, 2017 · 5 comments · Fixed by #29
Closed

Using lodash's wrap method is prevented in grunt because of underscore.string #26

mazesoul opened this issue Mar 29, 2017 · 5 comments · Fixed by #29

Comments

@mazesoul
Copy link

When using lodash wrap method in a Gruntfile, there are errors because grunt-legacy-log mixes in underscore.string.

Reproduction

At the top of a Gruntfile.js add the following

const _ = require('lodash');

if (_.isString(_.wrap(_.noop, _.noop))) {
  console.info('grunt-legacy-log messes up lodash wrap function by mixing in underscore.string');
}

Where

The problem arises from here https://github.com/gruntjs/grunt-legacy-log/blob/master/index.js#L20-L22.

@axten
Copy link
Contributor

axten commented Apr 25, 2018

@shama
please see wikimedia/grunt-stylelint#49
We have massive problems with that overrides because of lines:

// The upcoming lodash 2.5+ should remove the need for underscore.string.
var _ = require('lodash');
_.str = require('underscore.string');
_.mixin(_.str.exports());

It modifies lodash functions for all npm packages using the same lodash version!!
This was not a problem until you updated to newest lodash version. There are now many many potentially failing packages out there when using lodash with grunt.

please fix that as soon as possible!

@jdforrester
Copy link

Brilliant. Is there going to be a new release of grunt pulling in grunt-legacy-log@1.0.2 soon?

@shama
Copy link
Member

shama commented Apr 26, 2018

@jdforrester Grunt has it tagged "grunt-legacy-log": "~1.0.0", so fresh installs will get the latest patch version, 1.0.2.

That should fix the issue for those using lodash@4.17.5. We'll have a fix to prevent this also when using lodash@4.3.0 and for all future versions soon too: gruntjs/grunt-legacy-util#18

@axten
Copy link
Contributor

axten commented Apr 26, 2018

thank you @shama for the quick response!

@ntwb
Copy link

ntwb commented Apr 28, 2018

Awesome, thanks for speedy fix and release, greatly appreciated :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants