-
Notifications
You must be signed in to change notification settings - Fork 109
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
Optimize watched directories #623
Optimize watched directories #623
Conversation
patches/pkg-entry-points+1.0.2.patch
Outdated
@@ -0,0 +1,42 @@ | |||
diff --git a/node_modules/pkg-entry-points/.DS_Store b/node_modules/pkg-entry-points/.DS_Store |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
The failing test is a weird one: there is an unexpected file ( |
Discussed in tooling meeting, this seems fine and can move ahead when it has passing tests. |
@mansona I think when we discussed this PR, you mentioned an issue about leaking stuff in scenario-tester that is being worked on. Has this been fixed meanwhile, or could you point me to an issue/PR I can track? |
@simonihmig yes this would be included in this PR: embroider-build/scenario-tester#34 which was released in scenario-tester@4 embroider-build/scenario-tester#35 The underlying issue was in fixiturify project: stefanpenner/node-fixturify-project#87 |
I see, thank you @mansona! So next step is getting us to This was only flagged a major because you could rely on the wrong behaviour that could break tests now, is that correct? Or any other things to be aware of? |
I'm pretty sure that's the only notable change that is included in the major, there may be a few other type changes and one other API change but there is a 1-1 replacement if those changes are hit 👍 I think just trying it and working through should be good enough without too much other investigation |
Patched pkg-entry-points for now, awaiting upstream PR...
2da1dd0
to
de5f6e5
Compare
package.json
Outdated
@@ -13,6 +13,7 @@ | |||
"types/*" | |||
], | |||
"dependencies": { | |||
"pkg-entry-points": "^1.0.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is in the wrong package.json?
With
watchDependencies
defined, eai is currently creating aWatchDir
based on the package's root folder for handling imports of v2 addons.The problem with this is that it will trigger a rebuild of the app when something changes outside of the folders where the actual importable files live in (which is in
./dist
, assuming the conventional setup of v2 addons), most notably the./src
folder. This would make the app watcher fire multiple times in succession: once for the change in./src
, and later (when the rollup build has finished) for the change in./dist
. See also: embroider-build/embroider#1901Instead of watching the whole package folder, this PR is looking at the package.json exports (if existing) as the source of truth for what is importable, and derives a minimal set of folders containing these files, which are as close as possible to these files. For example, when an addon has
./dist/components/foo.js
and./dist/components/bar.js
as the only files covered by exports, this would make./dist/components
be the only folder being watched, ignoring any changes in e.g../src
or./declarations
.Note that I am only referring to
./src
or./dist
as examples, the code has none of these hard-coded (with one exception, see inline-comment), but as said above derives everything from the package.json. So the change here should work also in v2 setups not following our conventional setup based on the blueprint.This is one puzzle piece of fixing embroider-build/addon-blueprint#32. Again, 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.