-
Notifications
You must be signed in to change notification settings - Fork 279
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
build: monorepo-aware reloading in editor
#1286
Conversation
± Registry diff
📊 PerformanceKeyNote that each bar component rounds up to the nearest 100ms, so each full bar is an overestimate by up to 400ms.
Data
|
Codecov Report
@@ Coverage Diff @@
## main #1286 +/- ##
=======================================
Coverage 63.43% 63.43%
=======================================
Files 61 61
Lines 7212 7212
Branches 1680 1680
=======================================
Hits 4575 4575
Misses 2553 2553
Partials 84 84
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Deploying with Cloudflare Pages
|
Related: #1189 |
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.
Amazing, thanks for doing this Nimo! One thing to think about: now the only source package this doesn't work for is @penrose/optimizer
which has a more complicated build process that Vite doesn't understand, which is why we still need "dependsOn": ["^build"]
for the three dev tasks packages/editor/package.json
. But those tasks don't actually depend on core:build
or components:build
, just optimizer:build
. Doesn't really matter though :)
Description
Previously, we had trouble watching changes from packages in our monorepo. For instance, a change in
@penrose/core
will not trigger a reload when runningyarn start
because it only watches source file changes within@penrose/editor
.After #1160, all of our packages are ES modules and vite is capable of treating ESM dependencies as source. This PR configures
@penrose/editor
such that it watches changes from bothcore
andcomponents
.Implementation strategy and design decisions
core
as source,editor
's vite config also needs to know about how to deal with top level await. Added the suggested plugin.ttsc
incore
. Therefore, we need to make surecore
has minimal configuration. This PR removesttsc
fromcore
and changed all absolute path imports to relative.../<module>/file
, which is pretty logical.Examples with steps to reproduce them
Run
yarn start
. Touch any files incore
orcomponents
to trigger HMR in vite.Checklist
Open questions
This issue was very helpful for this PR, but I couldn't reproduce the regex-based approach because
examples
andoptimizer
have different folder structures. I'm inclined to keep the aliases explicit because it's much more transparent.