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

calling modernizr.build in Node JS more than once at the same time #1832

Closed
hedgehog90 opened this Issue Jan 13, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@hedgehog90
Copy link

hedgehog90 commented Jan 13, 2016

How can I run 2 builds at the same time?
If I call

require("modernizr").build({}, function (result) {
    console.log(1);
});
require("modernizr").build({minify: true}, function (result) {
    console.log(2);
});

Then only the second callback runs, but it runs twice!
So the output is:

2
2

This seems to me a very odd design choice. I'd like to fix it so I can call more than 1 build at the same time in nodejs.
How do I do this?

@hedgehog90 hedgehog90 changed the title Very unusual scope behaviour calling modernizr.build in Node JS calling modernizr.build in Node JS more than once at the same time Jan 13, 2016

patrickkettner added a commit to patrickkettner/Modernizr that referenced this issue Jan 13, 2016

@patrickkettner

This comment has been minimized.

Copy link
Member

patrickkettner commented Jan 13, 2016

So, this was a stupid mistake on our (well, my) part

what was happening was clobbering of a global config object. So that when the async callback was called on the build completion, the second build's config had overwritten it. This is patched in #1832, waiting on travis to give the thumbs up then I will do another release

patrickkettner added a commit to patrickkettner/Modernizr that referenced this issue Jan 13, 2016

@hedgehog90

This comment has been minimized.

Copy link
Author

hedgehog90 commented Jan 13, 2016

Oh right! I just figured that's how it was supposed to work.
I've just spent hours rewriting my website compiler to suit the modernizr.build function... Wish you hadn't told me that now.

@patrickkettner

This comment has been minimized.

Copy link
Member

patrickkettner commented Jan 14, 2016

not sure I understand what you are saying.

patrickkettner added a commit to patrickkettner/Modernizr that referenced this issue Jan 14, 2016

patrickkettner added a commit to patrickkettner/Modernizr that referenced this issue Jan 14, 2016

patrickkettner added a commit that referenced this issue Jan 14, 2016

Merge pull request #1833 from patrickkettner/fix-global-config-leak
create a requireConfig instance per build call. fixes #1832
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.