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

Option to skip initial build when using watch flag #9730

Closed
alshdavid opened this issue Sep 25, 2019 · 11 comments
Closed

Option to skip initial build when using watch flag #9730

alshdavid opened this issue Sep 25, 2019 · 11 comments

Comments

@alshdavid
Copy link

alshdavid commented Sep 25, 2019

Feature request

Option to skip initial build when using watch flag.

What is the expected behavior?

When --watch --skip-initial-build, the skip-initial-build flag tells webpack not to build initially, but instead build on subsequent detected changes.

What is motivation or use case for adding/changing the behavior?

When working with mono-repos that have multiple packages where some packages depend on higher level packages, developers must build the top level dependencies first, then watch everything.

So imagine there are two packages a and b
b depends on a, so to successfully build b, a must already be built.

Developers would:
build a
watch a && watch b

b will automatically rebuild when it detects a change to a, which the initial build from watching a will produce.
This triggers a waterfall of builds when starting.

a, b, a, b

You can only imagine how bad it gets in projects with a few too many packages

If a developer could skip the initial building on a watch the flow would be

build a
build b
watch skip a && watch skip b

How should this be implemented in your opinion?
Are you willing to work on this yourself?

Added a pull request
#9735

@sokra
Copy link
Member

sokra commented Sep 25, 2019

We can't skip the initial build as it's needed to figure out dependencies that need to be watched.

We could skip the initial emit.

But I think the better way to solve this is to avoid emitting assets if it matches the file on disk. This won't require a flag and will speed up all builds when assets already exist.

@alshdavid
Copy link
Author

That's fair. The change in my PR only skips the initial emit behind a flag.

Great idea. Any clues on where that belongs? I might spend some time trying to add it in.

@alshdavid
Copy link
Author

Alright, I have changed the option in my PR to watchOptions.skipInitialEmit = false and added tests to cover the behaviour.

#9735

@alshdavid
Copy link
Author

Hey, any updates on this?

@webpack-bot
Copy link
Contributor

This issue had no activity for at least three months.

It's subject to automatic issue closing if there is no activity in the next 15 days.

@alexander-akait
Copy link
Member

bump

@giulianok
Copy link

updates on this? very needed

@goldmont
Copy link

+1

1 similar comment
@1aurabrown
Copy link

+1

@RobbySingh
Copy link

RobbySingh commented Apr 27, 2020

Don't know how long this request will take. I wanted the feature so I had a look at the merge request.

The changes themselves are straightforward. Though it's not recommended, you can apply the changes yourself. Just be aware that these changes will be overwritten during webpack updates

https://github.com/webpack/webpack/pull/9735/files#

(you do not need the changes to the test/ directory)

@jonahbron
Copy link

Bump

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

No branches or pull requests

9 participants