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.
Posting as a draft because this might be pointless. After getting rid of
app/forms/index.ts, I saw that all the forms and fields were still being loaded on every page. After thinking about why this would be, I remembered that the routes file necessarily imports every page in the app, and that means that no matter what page you load, you have a dependency tree that ultimately points to every file used anywhere in the app.So then I thought it might not be pointless if it helps with bundle splitting. I tested this theory by converting one form to a dynamic import.
diff showing how to convert a route to dynamic import
I then saw in the network tab that we were in fact no longer downloading
app/forms/ip-pool-create.tsxon every page. But when I popped back tomainand did the same thing, it had the same effect. That means getting rid of theapp/formsbarrel file was not necessary to achieve this effect, only the lazy import. Sad.There's not really any downside to merging this since I already did the work and it's possible it will help with performance in other ways, for example by letting Vite be smarter about what files to hot reload.