-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
fix multi target #140
fix multi target #140
Conversation
It is on purpose defined as Basic task as we use custom configurations which grunt cannot handle when using multitask. (#122) |
Codecov Report
@@ Coverage Diff @@
## master #140 +/- ##
==========================================
+ Coverage 67.67% 68.65% +0.97%
==========================================
Files 8 8
Lines 198 201 +3
Branches 50 51 +1
==========================================
+ Hits 134 138 +4
Misses 52 52
+ Partials 12 11 -1
Continue to review full report at Codecov.
|
@danez I've changed back to a basic task, thanks for the notice |
@danez , weird that I've already signed the CLA agreement but it shows not here. Did I do something wrong? And why you prefer not add |
ok, it's the email address, I'll fix it. |
Update package.json
squashed to force update :) the license check passes now |
tasks/webpack.js
Outdated
@@ -64,7 +66,13 @@ module.exports = (grunt) => { | |||
} | |||
} | |||
|
|||
if (!opts.keepalive) done(); | |||
if (!opts.keepalive) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will have weird effects if different targets have different keepalive
set. Can we instead maybe check every target and if at least one target has keepalive===true then do it?
So basically outside the forEach have
let keepalive = false;
and then for every target:
keepalive = keepalive || opts.keepalive;
Als the counter decrease has to be outside this if, as otherwise we can potentially never reach 0 right now if on target has keepalive true.
so maybe just simplify to
if (--runningTargetCount === 0 && !keepalive) done();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thanks
Looks good besides the comment I made. Would you be willing doing the same thing then also for webpack-dev-server? If not it's okay, I can easily duplicate. |
@danez , OK, I'll do this in another PR. |
Thank you |
This is a bug when running
grunt webpack
with multi targets. If we define multi targets for this plugin, then only 1 or 2 of them will run when user callsgrunt webpack
, and the tasks are picked randomly.This is because this task is defined as a grunt basic task, but actually it is designed to be used as a grunt multi tasks. And when we call
grunt webpack
it should handle all targets, but now the code use a globaldone
for all targets, any of them finished will cause this taskdone
.The test fail because of Grunt bug, I'll work on that fix first.
An example which repro the bug: