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

Reset current compilation if file was changed #369

Open
1 task done
sanex3339 opened this issue Feb 15, 2019 · 4 comments
Open
1 task done

Reset current compilation if file was changed #369

sanex3339 opened this issue Feb 15, 2019 · 4 comments

Comments

@sanex3339
Copy link

The Issues page for this repository is not a support forum. Please ask questions on StackOverflow or the webpack Gitter (https://gitter.im/webpack/webpack). Questions will be closed. If you proceed with this form, please fill out all fields, or your issue may be closed as "invalid." Please do not delete this template from a new issue. Please remove this header to acknowledge this message.

  • Operating System: Mac OS 10.12.4
  • Node Version: 8.11.2
  • NPM Version: 5.6.0
  • webpack version: 4.29.3
  • webpack-dev-middleware Version: 3.5.2
  • [] This is a feature request
  • This is a bug

Expected Behavior

Current active compilation should reset if file was changed and next compilation should start immediate

Actual Behavior

Current active compilation will finish first if file was changed and only after that - next compilation will start

For Bugs; How can we reproduce the behavior?

I'm using latest koa-webpack + webpack@4.
Start server, change file, after two seconds change file again. As result - two full compilations instead of 2 seconds of first compilation + full second compilation.

@alexander-akait
Copy link
Member

Looks problem on koa-webpack side, we don't officially support koa, i recommend use webpack-dev-server. Anyway please create minimum reproducible test repo and describe in readme what you have and what you expect.

@sanex3339
Copy link
Author

sanex3339 commented Feb 15, 2019

I looked at sources
https://github.com/webpack/webpack-dev-middleware/blob/master/lib/context.js#L95

context.compiler.hooks.invalid.tap('WebpackDevMiddleware', invalid);
  context.compiler.hooks.run.tap('WebpackDevMiddleware', invalid);
  context.compiler.hooks.done.tap('WebpackDevMiddleware', done);
  context.compiler.hooks.watchRun.tap('WebpackDevMiddleware', (comp, callback) => {
    invalid(callback);
  });

None of this hooks was triggered when i changed file during existing compilation process

@alexander-akait
Copy link
Member

@sanex3339 no problem with webpack-dev-server, please create minimum reproducible test repo

@alexander-akait
Copy link
Member

alexander-akait commented May 15, 2019

Here solution webpack/webpack-dev-server#1479 (comment)

@alexander-akait alexander-akait added this to the 4.0.0 milestone May 15, 2019
@alexander-akait alexander-akait modified the milestones: 4.0.0, 4.1.0 Nov 22, 2019
@alexander-akait alexander-akait removed this from the 4.1.0 milestone Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants