Skip to content

Watch with multiple entry points #32

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

Closed
clechner77 opened this issue Jan 10, 2020 · 3 comments
Closed

Watch with multiple entry points #32

clechner77 opened this issue Jan 10, 2020 · 3 comments
Assignees

Comments

@clechner77
Copy link

In my projects, I setup each webpart to have it's own entry point, a dedicated folder under SCRIPTS and a dedicated hbs file under WEBPARTS.

My issue is that if I run "gulp watch --prod" the first time a change is made and saved, it rebuilds ALL webarts/entry points. After that, however, it works how I would expect, only rebuilding the webpart/entry point for which the change is made. Note - I believe I did need to remove COPYASSETSMAP and any entries or else it does rebuild all after every change.

I wonder if it's possible to eliminate that first rebuild of all when starting watch?

@koltyakov koltyakov self-assigned this Jan 10, 2020
@koltyakov
Copy link
Owner

Hi @clechner77,

Only the changed webpart .hbs is built during the watch, even on a first change. So I assume you're mostly mentioning JS/TS.

Regarding JS/TS entry points and watch, this is how Webpack watches, before tracking incremental changes it has, in my knowledge, to build everything, otherwise, it's even not obvious how to track a change. Imagine a change in a JS which is imported in another JS which is imported... you got an idea.

In projects with a larger code base and many entry points when build time is relevantly bloated and becomes not comfortable, especially as you know that within many only some entry points are at active development, there is a special parameter in sp-build-tasks which reduces the active entry points.

Not sure that I documented this, but we use that parameter for scoping entry points all over the projects.

To limit an entry point you can start watch, or build, or start commands with --webpack-targets argument:

gulp watch --webpack-targets=target1.js,target2.js

Where target1.js and so on is a target from app.js/webpackItemsMap/*.

@clechner77
Copy link
Author

This is EXACTLY what I was looking for. Thank you! I'm not sure if that parameter is documented. I looked around but probably missed it.

@koltyakov
Copy link
Owner

Closing the issue. Documented in sp-build-tasks Wiki page.

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

2 participants