-
Notifications
You must be signed in to change notification settings - Fork 281
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
Use Remix presets for virtual routes #1940
Conversation
Thinking about this more, maybe we could create a secondary Remix app with only our virtual routes, and use the Node handler instead of workerd for this 🤔 Will check this idea soon. Update: too many rabbit holes with this approach, going back to adding routes to the preset approach. |
Oxygen deployed a preview of your
Learn more about Hydrogen's GitHub integration. |
We detected some changes in |
* Move Oxygen plugin to mini-oxygen package * Do not log favicon requests * Ignore .shopify directory from all examples * Move Hydrogen plugin to hydrogen package * Add coverage check * Pass plugin options using a public API * Get plugin options in CLI for checks * Flatten Oxygen plugin options * Type safety for plugin API * Simplify services in MiniOxygen * Improve critical CSS code and docs * Adapt subrequest profiler backend to Vite * Replace setupScripts with crossBoundarySetup in MiniOxygen Vite * Add Vite types to tsconfig.json * Create __H2O_LOG_EVENT directly in Vite * Update projects to new plugin paths * Fix HMR * Fix cross-package types * Minor fixes to build types * Fix virtual route test for classic compiler * Fix type * Add subrequest profiler logger globally in Node environments * Improve types and split logic of mini-oxygen handler * Replicate requestHook at the Vite Environment level * Fix re-using request body * Make the request hook be a POST request * Move source of truth for sub-request profiler types to Hydrogen package * Fix cross-package types * Start sending subrequest-profiler events from Hydrogen middleware instead of remix-oxygen * Support subrequest profiler in Node.js servers * Use Remix presets for virtual routes (#1940) * Use Remix presets for virtual routes * Pin oxygen-cli dependency to fix installation * Avoid adding virtual routes in build * Wrap virtual routes in virtual root * Omit user root when rendering virtual routes * Move buildDirectory to preset and use it in projects * Update tests * Use RemixConfig for appDir * Hide non actionable error about critical CSS in virtual routes * Improve types * Read remix config from Hydrogen plugin * Fix plugin types in vite.config.ts * Changesets * Remove unused internal feature * Remove @experimental comment * Dedup package-lock.json
This would allow us to remove a lot of hacky code to add virtual routes:
However, there are currently some issues:
/graphiql
and/subrequest-profiler
to builds with this approach. We could probably just rely onprocess.env.NODE_ENV
to at least avoid it in production builds.Other thoughts:
api: {}
). That way we could add the preset only for development, and if the user doesn't pass--disable-virtual-routes
to our CLI. Also, you wouldn't need to specifyhydrogen.preset()
invite.config.js
.