fix: revert alias handling for nitro-v2-vite-plugin #5378
main fromrefs/pull/5378/head·merged by schiller-manuel(GitHub profile, opens in a new tab) the approach did not work with bun, bun only installs h3@v1 (it probably disregards v2 as it is still beta)
Summary by CodeRabbit#
New Features
- Added a CommonJS entry point for improved compatibility with CJS environments.
Refactor
- Simplified SSR build configuration by removing custom runtime resolution logic.
Chores
- Updated HTTP framework dependency to a v2-compatible alias and cleaned up legacy v1 references.
- Adjusted build settings to rely on default CommonJS behavior.
Impact
- Better interoperability with diverse build systems.
- More predictable server-side builds with fewer edge cases.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: start-server-core
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: nitro-v2-vite-plugin
View your CI Pipeline Execution ↗ for commit c5581b08d28f83484c0b49687d8ab169ccdd2086
Command Status Duration Result nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded 4m 9s View ↗ nx run-many --target=build --exclude=examples/*...✅ Succeeded 22s View ↗
☁️ Nx Cloud last updated this comment at
2025-10-05 20:27:22UTCMore templates
- tanstack-router-solid-example-basic
- tanstack-router-solid-example-basic-devtools-panel
- tanstack-router-solid-example-basic-file-based
- tanstack-router-solid-example-basic-non-nested-devtools
- tanstack-router-solid-example-basic-solid-query
- tanstack-router-solid-example-basic-solid-query-file-based
- tanstack-router-solid-example-basic-ssr-streaming-file-based
- tanstack-router-solid-example-kitchen-sink-file-based
- tanstack-router-solid-example-quickstart-file-based
- tanstack-solid-start-example-bare
- tanstack-solid-start-example-basic
- tanstack-solid-start-example-basic-static
- tanstack-router-react-example-authenticated-routes
- tanstack-router-react-example-authenticated-routes-firebase
- tanstack-router-react-example-basic
- tanstack-router-react-example-basic-default-search-params
- tanstack-router-react-example-basic-devtools-panel
- tanstack-router-react-example-basic-file-based
- tanstack-router-react-example-basic-non-nested-devtools
- tanstack-router-react-example-react-query
- tanstack-router-react-example-basic-react-query-file-based
- tanstack-router-react-example-basic-ssr-file-based
- tanstack-router-react-example-basic-ssr-streaming-file-based
- tanstack-router-react-example-basic-virtual-file-based
- tanstack-router-react-example-basic-virtual-inside-file-based
- tanstack-router-react-example-deferred-data
- tanstack-router-i18n-paraglide
- tanstack-router-react-example-kitchen-sink
- tanstack-router-react-example-kitchen-sink-file-based
- tanstack-router-react-example-kitchen-sink-react-query
- tanstack-router-react-example-kitchen-sink-react-query-file-based
- tanstack-router-react-example-large-file-based
- tanstack-router-react-example-location-masking
- tanstack-router-react-example-navigation-blocking
- tanstack-router-react-example-quickstart
- tanstack-router-react-example-quickstart-esbuild-file-based
- tanstack-router-react-example-quickstart-file-based
- tanstack-router-react-example-quickstart-rspack-file-based
- tanstack-router-react-example-quickstart-webpack-file-based
- router-monorepo-react-query
- router-mono-simple
- router-mono-simple-lazy
- tanstack-router-react-example-scroll-restoration
- tanstack-search-validator-adapters
- tanstack-start-example-bare
- tanstack-start-example-basic
- tanstack-start-example-basic-auth
- tanstack-start-example-basic-cloudflare
- tanstack-start-example-basic-react-query
- tanstack-start-example-basic-static
- tanstack-start-bun-hosting
- tanstack-start-example-convex-trellaux
- tanstack-start-example-counter
- tanstack-start-i18n-paraglide
- tanstack-start-example-large
- tanstack-start-example-material-ui
- tanstack-start-example-supabase-basic
- tanstack-start-tailwind-v4
- tanstack-start-example-trellaux
- tanstack-start-example-workos
- tanstack-router-react-example-view-transitions
- tanstack-router-react-example-with-framer-motion
- tanstack-router-react-example-with-trpc
- tanstack-router-react-example-with-trpc-react-query
@tanstack/arktype-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@5378@tanstack/directive-functions-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@5378@tanstack/eslint-plugin-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@5378@tanstack/history
npm i https://pkg.pr.new/TanStack/router/@tanstack/history@5378@tanstack/nitro-v2-vite-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@5378@tanstack/react-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@5378@tanstack/react-router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@5378@tanstack/react-router-ssr-query
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@5378@tanstack/react-start
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@5378@tanstack/react-start-client
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@5378@tanstack/react-start-server
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@5378@tanstack/router-cli
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@5378@tanstack/router-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@5378@tanstack/router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@5378@tanstack/router-devtools-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@5378@tanstack/router-generator
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@5378@tanstack/router-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@5378@tanstack/router-ssr-query-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@5378@tanstack/router-utils
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@5378@tanstack/router-vite-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@5378@tanstack/server-functions-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@5378@tanstack/solid-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@5378@tanstack/solid-router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@5378@tanstack/solid-start
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@5378@tanstack/solid-start-client
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@5378@tanstack/solid-start-server
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@5378@tanstack/start-client-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@5378@tanstack/start-plugin-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@5378@tanstack/start-server-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@5378@tanstack/start-static-server-functions
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@5378@tanstack/start-storage-context
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@5378@tanstack/valibot-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@5378@tanstack/virtual-file-routes
npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@5378@tanstack/zod-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@5378commit:
c5581b0Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/nitro-v2-vite-plugin/src/index.ts (1)
117-119: Fix h3 import version mismatch in virtual entry (packages/nitro-v2-vite-plugin/src/index.ts:117–119) nitropack depends on h3 v1.15.4 which doesn’t export fromWebHandler; this import will fail at runtime. Align your build on h3 v2 (e.g. update dependency or add an alias/peer-declaration for h3 v2).🧹 Nitpick comments (1)
packages/start-server-core/package.json (1)
71-71: Verify the version downgrade from beta.5 to beta.4.The dependency was downgraded from
h3@2.0.0-beta.5toh3@2.0.0-beta.4. Please confirm this downgrade is intentional and document the reason (e.g., breaking changes in beta.5, compatibility issues with Bun, or other considerations).Additionally, consider the stability implications of depending on a beta version. If this is intended for production use, evaluate whether the beta status aligns with your stability requirements.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between e94e9c7321ce8ba213ee421b4e1369429ffea384 and c5581b08d28f83484c0b49687d8ab169ccdd2086.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (5)
packages/nitro-v2-vite-plugin/package.json(2 hunks)packages/nitro-v2-vite-plugin/src/index.ts(1 hunks)packages/nitro-v2-vite-plugin/vite.config.ts(0 hunks)packages/start-server-core/package.json(1 hunks)packages/start-server-core/src/request-response.ts(1 hunks)
💤 Files with no reviewable changes (1)
- packages/nitro-v2-vite-plugin/vite.config.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/package.json
📄 CodeRabbit inference engine (AGENTS.md)
Use workspace:* protocol for internal dependencies in package.json files
Files:
packages/start-server-core/package.jsonpackages/nitro-v2-vite-plugin/package.json
packages/{*-start,start-*}/**
📄 CodeRabbit inference engine (AGENTS.md)
Name and place Start framework packages under packages/-start/ or packages/start-/
Files:
packages/start-server-core/package.jsonpackages/start-server-core/src/request-response.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript in strict mode with extensive type safety across the codebase
Files:
packages/nitro-v2-vite-plugin/src/index.tspackages/start-server-core/src/request-response.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Test
- GitHub Check: Preview
🔇 Additional comments (4)
packages/start-server-core/src/request-response.ts (1)
22-22: LGTM! Import source correctly updated to h3-v2 alias.The change aligns with the PR objective to migrate away from h3-v1 aliasing. All imported functions are retained in h3 v2 with backward-compatible APIs.
Based on learnings
packages/nitro-v2-vite-plugin/package.json (2)
64-64: LGTM! Removal of h3-v1 dependency aligns with PR objective.Removing the h3-v1 alias resolves the Bun compatibility issue mentioned in the PR description, where Bun only installs h3@v1 and disregards the h3@v2 beta.
43-43: Verify CommonJS bundle output Ensurevite buildactually generatesdist/cjs/index.cjs—for example, addbuild.lib.formats = ['cjs','es']inpackages/nitro-v2-vite-plugin/vite.config.ts—and confirm the file exists post-build.packages/nitro-v2-vite-plugin/src/index.ts (1)
113-113: LGTM! Simplified rollup plugin configuration.Removing the h3-v1 resolution logic aligns with the PR objective to revert the alias handling that didn't work with Bun.
I get this error with '@tanstack/nitro-v2-vite-plugin': ^1.132.40
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'h3-v2' imported from /app/.output/server/node_modules/@tanstack/start-server-core/dist/esm/request-response.js at Object.getPackageJSONURL (node:internal/modules/package_json_reader:316:9) at packageResolve (node:internal/modules/esm/resolve:768:81) at moduleResolve (node:internal/modules/esm/resolve:858:18) at defaultResolve (node:internal/modules/esm/resolve:990:11) at #cachedDefaultResolve (node:internal/modules/esm/loader:755:20) at ModuleLoader.resolve (node:internal/modules/esm/loader:732:38) at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:317:38) at #link (node:internal/modules/esm/module_job:208:49) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) { code: 'ERR_MODULE_NOT_FOUND', routerCode: 'BEFORE_LOAD' }
Sign in to join this conversation.
Walkthrough#
Introduces a CommonJS entry for nitro-v2-vite-plugin, removes h3-v1 aliasing and resolve logic in its SSR build, and drops cjs override in its Vite config. start-server-core switches from direct h3 to an aliased h3-v2 dependency and updates corresponding imports. No public API shape changes.
Changes#
packages/nitro-v2-vite-plugin/package.json,packages/nitro-v2-vite-plugin/vite.config.tspackages/nitro-v2-vite-plugin/src/index.tspackages/start-server-core/package.json,packages/start-server-core/src/request-response.tsSequence Diagram(s)#
Estimated code review effort#
🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs#
Poem#
Pre-merge checks and finishing touches#
❌ Failed checks (1 warning)
@coderabbitai generate docstringsto improve docstring coverage.✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment `@coderabbitai help` to get the list of available commands and usage tips.