-
-
Notifications
You must be signed in to change notification settings - Fork 5
feat: migrate to Nitro v3 and H3 v2 and vite support #40
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
Merged
Conversation
This file contains hidden or 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
Update core dependencies to support the latest versions: - Migrate from nitropack v2 to nitro v3 (^3.0.1-alpha.0) - Upgrade H3 from v1.15.3 to v2.0.1-rc.2 - Update pnpm catalog entries for consistency - Refresh lock file with new dependency tree This is the foundation for the complete migration to the new Nitro and H3 APIs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Migrate all Nitro-related imports from nitropack to nitro: - Update module declarations in src/types/index.ts - Change import paths across src files (index, rollup, utils) - Update tsdown external dependencies configuration - Standardize HTTP method names to uppercase (GET, POST, OPTIONS) - Remove deprecated defineNitroModule import These changes align with Nitro v3's new package structure and conventions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Update route handlers to use H3 v2 APIs: In graphql-yoga.ts: - Remove toWebRequest conversion (no longer needed) - Pass event.req and event.context directly to yoga.handleRequest In health.ts: - Replace setResponseStatus with direct event.res.status assignment - Set event.res.statusText for proper HTTP status messages - Update useRuntimeConfig import from nitro/runtime These changes align with H3 v2's simplified request handling and response APIs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Update all playground projects to use Nitro v3: - Change defineNitroConfig imports from nitropack/config to nitro/config - Update package.json dependencies in all playgrounds - Ensure consistency across nitro, apollo, and federation playgrounds This ensures all example projects work with the new Nitro v3 architecture. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add explicit imports for nitro-graphql utilities in playground files: - Import defineResolver in all resolver files - Import defineDirective in all directive files - Import defineSchema in schema.ts - Import defineGraphQLConfig in config.ts - Import defineEventHandler in routes These imports ensure proper TypeScript support and make the code more explicit, improving IDE experience and preventing potential runtime issues with auto-imports. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Owner
Author
|
🎉 Released as 2.0.0-beta.1! This PR has been published as the first beta release with Nitro v3 and H3 v2 migration completed. Published Package:
Key Changes:
|
…revent rebuild loops
…rror handling in directive parser, and enhance ofetch client generation
Owner
Author
✅ Beta 2 ReleasedAll changes from this PR have been released in v2.0.0-beta.2. 🎯 What's Fixed
📦 Try It Nowpnpm add nitro-graphql@2.0.0-beta.2🐛 Found Issues?Please open a new issue if you encounter any problems with this release. Thanks everyone for testing and providing feedback! 🙏 |
- Bump '@antfu/eslint-config' to ^6.0.0 - Update '@apollo/subgraph' to ^2.11.3 - Upgrade '@graphql-codegen/typescript' to ^5.0.2 - Upgrade '@graphql-codegen/typescript-operations' to ^5.0.2 - Upgrade '@graphql-codegen/typescript-resolvers' to ^5.1.0 - Update '@nuxt/kit' and '@nuxt/schema' to ^4.1.3 - Bump '@types/node' to ^24.7.2 - Upgrade 'bumpp' to ^10.3.1 - Update 'graphql-scalars' to ^1.25.0 - Upgrade 'nuxt' to ^4.1.3 - Update 'oxc-parser' to ^0.95.0 - Bump 'tsdown' to ^0.15.7 - Upgrade 'vue-router' to ^4.6.2 - Update 'zod' to ^4.1.12
…aphQL config and user resolvers
…raphQL integration
Merge main branch into migration branch, resolving all conflicts: - Keep Nitro v3 / H3 v2 infrastructure from migration branch - Adopt main's enhanced error handling and diagnostics - Integrate main's path resolution and SDK generation improvements - Add troubleshooting documentation from main - Update dependencies to latest compatible versions - Maintain version 2.0.0-beta.4 (migration in progress) Key changes: - Version: 2.0.0-beta.4 (migration) + pnpm@10.19.0 (latest) - Enhanced resolver scanning with detailed warnings - Improved virtual module error handling - Service-specific path resolution for external services - Better SDK and ofetch client generation - Documentation improvements (.docs/ patterns added to eslint) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Deploying nitro-graphql with
|
| Latest commit: |
2c1aa1f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://74047140.nitro-graphql.pages.dev |
| Branch Preview URL: | https://feat-nitro-v3-h3-v2-migratio.nitro-graphql.pages.dev |
Created stub files for Nitro virtual modules (#nitro-internal-virtual/*) to prevent import resolution errors in Vite. These stubs are only used during build/bundling and are overridden by Nitro's virtual module system at runtime. Changes: - Added 6 virtual module stub files in src/virtual/ - graphql-config.ts - server-schemas.ts - server-resolvers.ts - server-directives.ts - module-config.ts - debug-info.ts - Updated tsdown.config.ts to include src/virtual/** in entry points - Updated package.json imports to map virtual modules to stub files - Fixes "Missing specifier" errors when using nitro-graphql with Vite 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Updated '@antfu/eslint-config' to version 6.2.0 - Updated various '@graphql-tools/*' packages to their latest versions - Updated '@types/node', 'eslint', 'oxc-parser', 'tsdown' to their latest versions - Refactored virtual module imports from '#nitro-internal-virtual/*' to '#nitro-graphql/*' across multiple files - Updated TypeScript paths in tsconfig.json to reflect the new virtual module structure
- Use path resolver's getDefaultPaths() to initialize serverDir and clientDir - Properly handle custom paths.serverGraphql configuration - Fix virtual module config path resolution to use nitro.graphql.serverDir - Update relative dir paths for both Nuxt and Nitro frameworks - Playground: migrate from server/graphql to routes/graphql to test custom paths
- Add hook filters for resolveId and load to reduce Rust-JS bridge calls
- Return { code, moduleType: 'js' } format for rolldown compatibility
- Fix debug route method capitalization (GET vs get)
Follows Nitro's internal rolldown patterns for better performance.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Use rolldown's advancedChunks API for better chunking (Vite 7+) - Keep manualChunks as fallback for older Rollup/Vite - Properly split schemas and resolvers into separate chunks - Backward compatible with both bundlers Before: Single nitro.mjs chunk (44KB) After: Separate schemas.mjs (0.31KB) and resolvers.mjs (0.96KB) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Use advancedChunks for Rolldown (modern, performant) - Use manualChunks for Rollup (backward compatible) - Both bundlers correctly split schemas and resolvers into separate chunks - Harmless warnings from unknown options (expected behavior) Rolldown: advancedChunks used, manualChunks ignored warning Rollup: manualChunks used, advancedChunks unknown warning Both result in proper chunk splitting: - schemas.mjs (~0.31 KB) - resolvers.mjs (~0.96 KB) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Remove debugInfo.isDev check (route already registered only in dev mode) - Fix H3 v2 API: event.res.headers.set() instead of deprecated setResponseHeader() - Debug endpoint is production-safe (only registered when nitro.options.dev is true) Fixes debug dashboard not working in Vite dev mode. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add v2.0 beta notice at the top - Link to v1 branch for stable version - Highlight new features: Nitro v3/H3 v2, Rolldown, chunking, debug dashboard - Add debug dashboard endpoint to Quick Start - Clarify main branch is for v2 development 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add Test Projects section under Examples - Link to vite-nitro-graphql repository - Highlight Rolldown branch for Vite 7+ testing - Link to main branch for standard integration tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🚀 Migration to Nitro v3 and H3 v2 with Rolldown Support
This PR migrates
nitro-graphqlto Nitro v3 and H3 v2, and adds comprehensive Rolldown support for optimal performance with both modern and legacy bundlers.📦 Version
v2.0.0-beta.12
✨ Key Features
🎯 Rolldown Optimizations
{ code, moduleType: 'js' }for rolldown compatibilityadvancedChunksAPI for Rolldown (Vite 7+)manualChunksfallback for Rollup (backward compatible)Result: GraphQL code is now split into separate chunks:
schemas.mjs(~0.31 KB)resolvers.mjs(~0.96 KB)🛠️ Vite Integration Improvements
serverGraphqlpaths in Vite projects#nitro-graphql/*imports🐛 Debug Endpoint Fix
event.res.headers.set()nitro.options.devis truehttp://localhost:3000/_nitro/graphql/debug🔄 H3 v2 Migration
setResponseHeader()→event.res.headers.set()🧪 Testing
Rolldown (Vite 7+)
✅ Chunks correctly split with
⚠️ Harmless warning: "
advancedChunksmanualChunksoption is ignored"Rollup (Legacy Vite)
# Same build command✅ Chunks correctly split with
⚠️ Harmless warning: "Unknown output options: advancedChunks"
manualChunksDebug Dashboard
✅ Dashboard loads with full diagnostic information
✅ Production build excludes debug route (secure)
📝 Breaking Changes
None - fully backward compatible with existing configurations.
🔗 Related Issues
📊 Performance Impact
Bundle Splitting:
Build Performance:
✅ Checklist