Fix: Remove NodeJS dependency for get-virtual-routes.ts#3267
Fix: Remove NodeJS dependency for get-virtual-routes.ts#3267kdaviduik merged 6 commits intoShopify:mainfrom
Conversation
|
I have signed the CLA! |
|
Great PR at first glance, thanks @darintanakaFN for submitting this — we'll have a look at this early week and let you know of any issues (or else merge). New release coming soon, so assuming all good, will make sure to have this issue fixed. |
Sounds good! Thanks for the response |
|
Oxygen deployed a preview of your
Learn more about Hydrogen's GitHub integration. |
kdaviduik
left a comment
There was a problem hiding this comment.
I added a missing changeset, other than that LGTM! Thanks Darin!
WHY are these changes introduced?
Currently the file
packages/hydrogen/src/vite/get-virtual-routes.tsuses NodeJS specific functions to get the virtual routes (graphiql, subrequest profiler, etc).When the
hydrogenRoutesfunction is called during the Hydrogen build process if the current execution environment is in Mini-Oxygen or Cloudflare an error is thrown which prevents the build from succeedingWHAT is this pull request doing?
Removes
getVirtualRoutesfromget-virtual-routes.ts(this function isn't used anywhere)Removes all NodeJS imports from
get-virtual-routes.tsRemoves unit test for
getVirtualRoutesHOW to test your changes?
Verify unit test
packages/hydrogen/src/vite/get-virtual-routes.test.tsis passingI have a test npm package with these changes you can add this package as a depedency like below:
in a test hydrogen react router 7 project.
Verify
shopify hydrogen NODE_ENV=development shopify hydrogen dev --codegenbuilds successfullyVerify
NODE_ENV=test npm run build && shopify hydrogen previewbuilds successfullyChecklist