-
Notifications
You must be signed in to change notification settings - Fork 294
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
Incorporate the v3_routeConfig
future flag for Remix.
#2722
Open
seanparsons
wants to merge
19
commits into
main
Choose a base branch
from
refactor/v3_routeconfig_flag
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,572
−882
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
d4b6a03
WIP adding the v3_routeConfig flag.
seanparsons d347234
WIP testing the example projects.
seanparsons e6ded23
WIP Trying to diagnose the skeleton project startup failure.
seanparsons e19ab47
Reimplemented virtual routes to build paths without node libraries.
seanparsons 1acaac3
Removed change to multipass project.
seanparsons 55a1450
Merge remote-tracking branch 'origin' into refactor/v3_routeconfig_flag
seanparsons 010deb3
Multipass example now uses v3preset.
seanparsons c49e589
Fix virtual route layout
wizardlyhel 3cb970e
fix the ordering of virtual routes
wizardlyhel 205211f
Merge remote-tracking branch 'origin' into refactor/v3_routeconfig_flag
seanparsons 49fd22e
CLI test fixes.
seanparsons d6d5c8a
Working unit tests.
seanparsons 8b681b3
Additional patch to get the tests working correctly.
seanparsons a28175a
Merge remote-tracking branch 'origin' into refactor/v3_routeconfig_flag
seanparsons c5e540e
Fixing eslint errors that arose after the merge.
seanparsons f366301
Applied prettier fixes to virtual-root.tsx.
seanparsons ad96662
Added changeset for v3_routeConfig.
seanparsons 043b1b3
Removed change to docs page because it's unnecessary.
seanparsons ec7de1b
Merge branch 'main' into refactor/v3_routeconfig_flag
wizardlyhel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
--- | ||
'skeleton': patch | ||
'@shopify/hydrogen': patch | ||
'@shopify/cli-hydrogen': patch | ||
--- | ||
|
||
Added support for the Remix future flag `v3_routeConfig`. | ||
|
||
Remix documentation for the `v3_routeConfig`: [https://remix.run/docs/en/main/start/future-flags#v3_routeconfig](https://remix.run/docs/en/main/start/future-flags#v3_routeconfig) | ||
Details the base changes that need to be made to enable the flag, including the up to 3 additional dependencies that need to be added. | ||
|
||
Two files need to be changed once the above instructions have been applied. | ||
|
||
1. In the `app/routes.ts` file, a support function needs to be included to get the additional routes that were originally added in the vite plugin. With a file like the following: | ||
|
||
```typescript | ||
import {flatRoutes} from '@remix-run/fs-routes'; | ||
import type {RouteConfig} from '@remix-run/route-config'; | ||
import {route} from '@remix-run/route-config'; | ||
import {remixRoutesOptionAdapter} from '@remix-run/routes-option-adapter'; | ||
|
||
export default [ | ||
...(await flatRoutes({rootDirectory: 'fs-routes'})), | ||
|
||
...(await remixRoutesOptionAdapter(/* ... */)), | ||
|
||
route('/hello', 'routes/hello.tsx'), | ||
] satisfies RouteConfig; | ||
``` | ||
|
||
Include the `hydrogenRoutes` function like so: | ||
|
||
```typescript | ||
import {flatRoutes} from '@remix-run/fs-routes'; | ||
import type {RouteConfig} from '@remix-run/route-config'; | ||
import {route} from '@remix-run/route-config'; | ||
import {remixRoutesOptionAdapter} from '@remix-run/routes-option-adapter'; | ||
import {hydrogenRoutes} from '@shopify/hydrogen'; | ||
|
||
export default hydrogenRoutes([ | ||
...(await flatRoutes({rootDirectory: 'fs-routes'})), | ||
|
||
...(await remixRoutesOptionAdapter(/* ... */)), | ||
|
||
route('/hello', 'routes/hello.tsx'), | ||
]) satisfies RouteConfig; | ||
``` | ||
|
||
The function should wrap around all of the routes so that the priority of the routes is applied correctly. | ||
|
||
2. In the Vite config (`vite.config.ts` usually) the `remix` plugin needs to have it's configuration slightly altered. | ||
|
||
From this: | ||
|
||
```typescript | ||
... | ||
remix({ | ||
presets: [hydrogen.preset()], | ||
... | ||
``` | ||
To this: | ||
```typescript | ||
... | ||
remix({ | ||
presets: [hydrogen.v3preset()], | ||
... | ||
``` | ||
This is due to the `routes` configuration option not being allowed with the `v3_routeConfig` future flag enabled. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import {flatRoutes} from '@remix-run/fs-routes'; | ||
import type {RouteConfig} from '@remix-run/route-config'; | ||
import {hydrogenRoutes} from '@shopify/hydrogen'; | ||
|
||
export default hydrogenRoutes([...(await flatRoutes())]) satisfies RouteConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import {flatRoutes} from '@remix-run/fs-routes'; | ||
|
||
export default flatRoutes(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
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 would wrap this instruction on a
diff -/+
block instead