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

Run compiler in nextTick when callback provided #11784

Closed
wants to merge 2 commits into from

Conversation

piecyk
Copy link

@piecyk piecyk commented Oct 22, 2020

What kind of change does this PR introduce?

With this change it would be possible to register event on compiler when callback is provided.

For example with current implementation, this will not log for first run as webpack already started

let compiler = webpack(options, callback);

compiler.hooks.watchRun.tap('Foo', (compilation) => {
  logger.success(`Compilation starting...`);
});

Would suggest to wrap with process.nextTick. Having this would be possible to refactor webpack-cli watch logic and fix the DeprecationWarning on callback webpack/webpack-cli#1918

Did you add tests for your changes?
No

Does this PR introduce a breaking change?
No

What needs to be documented once your changes are merged?

There is any

@webpack-bot
Copy link
Contributor

For maintainers only:

  • This needs to be documented (issue in webpack/webpack.js.org will be filed when merged)
  • This needs to be backported to webpack 4 (issue will be created when merged)

@piecyk piecyk force-pushed the give-time-to-configure-compiler branch from 353e0eb to 02337bc Compare October 22, 2020 07:51
@webpack-bot
Copy link
Contributor

Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon.

@piecyk
Copy link
Author

piecyk commented Oct 22, 2020

There is workaround, rather than using compiler instance, push a plugin to options that would receive compiler making it possible to run on first run. Looks like there is no need for this change.

@webpack-bot
Copy link
Contributor

It looks like this Pull Request doesn't include enough test cases (based on Code Coverage analysis of the PR diff).

A PR need to be covered by tests if you add a new feature (we want to make sure that your feature is working) or if you fix a bug (we want to make sure that we don't run into a regression in future).

@piecyk Please check if this is appliable to your PR and if you can add more test cases.

Read the test readme for details how to write test cases.

@piecyk
Copy link
Author

piecyk commented Oct 22, 2020

Let's close this, using plugin should be enough.

@piecyk piecyk closed this Oct 22, 2020
@piecyk piecyk deleted the give-time-to-configure-compiler branch October 22, 2020 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants