[addon-shim]: Narrowed down broccoli trees for optimized file watching #1901
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
addon-shim is currently creating a broccoli tree based on the v2 addon's root folder, and funnelling that based on the entries in app-js/public-assets, and exposing these trees as treeForApp/treeForPublic for integration into a classic build.
The problem with this is that it will trigger a rebuild of the app when something changes outside of the folders where the actual files live in (like
dist/_app_
for the app tree), most notably the./src
folder, causing the app watcher to fire multiple times in succession: once for the change in./src
, and later (when the rollup build has finished) for the change in./dist
.The PR here optimizes this, by making the root folder that goes into the broccoli-funnel to be as close as possible to the actual files. So (assuming our opionionated v2 setup based on the blueprint), that would be
/path/to/addon/dist/_app_
instead of/path/to/addon
for the app tree, and same for the public tree.This is one part of addressing the "ignoring source files" approach discussed in embroider-build/addon-blueprint#32, the other (for the addon tree that is not covered by addon-shim) is this PR: embroider-build/ember-auto-import#623
I tested this in a local installation, and it did have the desired effect (when combined with the other PR): when changing only source files and not having the addon's build running in parallel, the app would not rebuild, as it would be expected.