feat(jsx-email): reimplement template dependency watching in preview #286
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.
Component / Package Name:
This PR contains:
Are tests included?
Breaking Changes?
If yes, please include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.
List any relevant issue numbers:
Description
This reimplements the template dependency watching that was rolled back in #256. Proper checks to filter out node_modules and non-template files, where the watch directory is calculated to be a directory in which node_modules or other source files exist or will be created.
The primary scenario for this is where a user has email components in a monorepo package, elsewhere in the repo, and by way of analyzing all dependencies and making sure that they're in the set of files we care about, we can avoid trying to build invalid files.
There's one small caveat on this: any templates with dependencies in node_modules will be ignored on this iteration, and will have to be rebuilt, and the preview server restarted when changed. This is intentional and incremental to assert that we aren't inserting new instability into the preview server. We'll follow up with another patch PR to re-enable template rebuild on dependency change in node_modules down the road.