Skip to content

fix(vite): use spa entry for vite-node fallback - #35037

Merged
danielroe merged 5 commits into
nuxt:4.xfrom
samiashi:samielachi/fix-spa-vite-node-entry
May 11, 2026
Merged

danielroe merged 5 commits into
nuxt:4.xfrom
samiashi:samielachi/fix-spa-vite-node-entry

Conversation

@samiashi

@samiashi samiashi commented May 11, 2026 •

Copy link
Copy Markdown

🔗 Linked issue

resolves #35033

📚 Description

Fixes the Nuxt 4.4.5 ssr: false dev-server regression where apps without experimental.viteEnvironmentApi can fail during startup with:

No entry found in rollupOptions.input

The ssr: false vite-node path now resolves against the client Vite server config. In the non-environment API path, that config only has the client Rollup input (entry) and does not expose a server input (server). As a result, resolveServerEntry() throws before Nuxt can configure vite-node.

@samiashi
samiashi requested a review from danielroe as a code owner May 11, 2026 11:05
@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions github-actions Bot added 4.x 🐛 bug Something isn't working as expected labels May 11, 2026
@danielroe

Copy link
Copy Markdown
Member

thank you for looking at this one ❤️

@pkg-pr-new

pkg-pr-new Bot commented May 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

@nuxt/kit

npm i https://pkg.pr.new/@nuxt/kit@35037

@nuxt/nitro-server

npm i https://pkg.pr.new/@nuxt/nitro-server@35037

nuxt

npm i https://pkg.pr.new/nuxt@35037

@nuxt/rspack-builder

npm i https://pkg.pr.new/@nuxt/rspack-builder@35037

@nuxt/schema

npm i https://pkg.pr.new/@nuxt/schema@35037

@nuxt/vite-builder

npm i https://pkg.pr.new/@nuxt/vite-builder@35037

@nuxt/webpack-builder

npm i https://pkg.pr.new/@nuxt/webpack-builder@35037

commit: a426bce

@codspeed

codspeed Bot commented May 11, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 20 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing samiashi:samielachi/fix-spa-vite-node-entry (a426bce) with 4.x (38a1826)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@danielroe
danielroe merged commit af09d0a into nuxt:4.x May 11, 2026
44 of 46 checks passed
@github-actions github-actions Bot mentioned this pull request May 11, 2026
vinayakkulkarni added a commit to vinayakkulkarni/tileserver-rs that referenced this pull request May 13, 2026
* ci: bump pnpm to 11.1.1 stable

Previously pinned to 11.0.0-rc.5 while the v11 release train was in candidate.
pnpm 11.1.1 (stable, released early May 2026) is the first non-RC release in
the v11 line. Bumps both the workflow setup-pnpm version field and the root
package.json packageManager field for parity with corepack.

Signed-off-by: Vinayak Kulkarni <[email protected]>

* ci(deps): group opentelemetry and arrow crates in dependabot

Solo dependabot bumps of crates in a diamond dependency chain silently break
trait-impl matching at the SDK boundary. The opentelemetry-prometheus crate
implements MetricReader against opentelemetry_sdk 0.X while the meter
provider expects 0.Y, causing 'trait bound not satisfied' clippy failures.

Hit on PRs #885 #888 #893 #895 in May 2026 when dependabot bumped the
opentelemetry family members one at a time. Each PR required a manual revert.
arrow-* + parquet have the same diamond shape (parquet pins arrow-*
transitively). Grouping forces a single atomic PR per family.

Refs: dependabot/dependabot-core#14794
Signed-off-by: Vinayak Kulkarni <[email protected]>

* fix(deps): align rust deps for vite-8 and may-2026 sweep

OpenTelemetry family: revert opentelemetry, opentelemetry_sdk, opentelemetry-otlp
and opentelemetry-semantic-conventions from 0.32 back to 0.31. The 0.32 train
exists upstream but tracing-opentelemetry 0.32.1 (latest, Jan 12 2026) still
hardcodes opentelemetry ^0.31.0 for all five OTel deps it pulls in, creating a
diamond conflict that breaks the Prometheus reader trait bound.

Unblock: tokio-rs/tracing-opentelemetry PR #258 (chore: Upgrade to OpenTelemetry
0.32). Currently open. When that merges and ships, bump back to 0.32 in a
single atomic group (see .github/dependabot.yml).

cql2 0.5.5 -> 0.5.6 and geo 0.32 -> 0.33: cql2 0.5.6 bumped its geo dep to
0.33, which unblocks the i_overlay diamond previously blocking us. mlt-core
0.9.x and the workspace converge on geo 0.33.

mlt-core 0.7.0 -> 0.9.1: breaking API renames. TileLayer01 -> TileLayer (the
'01' versioning suffix was dropped on the encoder type) and geojson::Geom32
type alias removed in favour of the raw geo_types::Geometry<i32>. Both
renames applied in transcode.rs; the layer field shape and the
TileLayer::encode signature are otherwise identical.

gdal + gdal-sys: pinned via [patch.crates-io] to AlexanderWillner/gdal#714 at
rev 968cf34a so cargo clippy --all-features compiles on a Homebrew macOS box
running libgdal 3.13 (GDT_Byte -> GDT_UInt8 + new bOperateInBufType field).
Drop the patch block when a gdal release >0.19.0 lands containing PR #714.
Tracking: georust/gdal#715.

Verified: cargo clippy --all-targets --all-features -- -D warnings (exit 0)
and cargo fmt --all --check (exit 0) on macOS 14 + libgdal 3.13.0 (Homebrew).

Signed-off-by: Vinayak Kulkarni <[email protected]>

* fix(deps): upgrade vite to 8 + nuxt-workers patch + nuxt spa workaround

Vite 7 -> 8 across the workspace. Adds a top-level `overrides: { vite: ^8.0.12 }`
to pnpm-workspace.yaml because Nuxt's peer dep otherwise still resolves Vite 7
in the lockfile. pnpm v9+ workspace mode silently ignores
`package.json#pnpm.overrides`, so the override must live in pnpm-workspace.yaml.

nuxt-workers 0.1.0 patch: the WorkerTransformPlugin in
node_modules/nuxt-workers/dist/module.mjs unconditionally appends a
`const __worker_exports__ = { ... }` block to every worker source via
MagicString.append(). With Vite 8 (Rolldown-backed bundler), the worker import
pipeline calls the transform twice per source, producing a duplicate identifier
and crashing the build:

  [PARSE_ERROR] Identifier `__worker_exports__` has already been declared
    at app/workers/parse-csv.ts:79:7
    at app/workers/parse-csv.ts:91:7

`pnpm dev` is unaffected (single transform pass). Upstream issue:
danielroe/nuxt-workers#191 (open since Nov 2025, package last released Feb 2025,
effectively unmaintained). pnpm patch adds a three-line idempotency guard at
dist/module.mjs:18 that bails out of the second transform when the shim is
already present. Patch lives at patches/[email protected] and is wired
in via pnpm-workspace.yaml#patchedDependencies. After clean install the
.pnpm/ folder picks up a `_patch_hash=...` suffix confirming the override.

apps/client/nuxt.config.ts: add `experimental: { viteEnvironmentApi: true }`
to work around Nuxt 4.4.5 + Vite 8 + ssr:false (SPA mode) dropping the
`rollupOptions.input.entry` key during config merge. Upstream issue
nuxt/nuxt#35033, fix PR nuxt/nuxt#35037 merged against 4.x but not yet
released. Drop the flag when Nuxt > 4.4.5 ships.

Catalog bumps: @types/node 25.6 -> 25.7 (and consolidated stray catalog block
churn left by an earlier `bunx taze` run).

Verified: pnpm dev -> HTTP 200 from localhost:3000, pnpm build -> dist/
written with index.html + _nuxt assets + fonts (12MB total).

Signed-off-by: Vinayak Kulkarni <[email protected]>

* fix(deps): include missing nuxt-workers patch file

The previous commit (516a04d) referenced `patches/[email protected]` in
pnpm-workspace.yaml#patchedDependencies but the actual patch file was never
staged. The local `patches/` directory was empty when `git add patches/` ran
(probably because an intermediate `rm -rf node_modules` interfered before pnpm
recreated the file). CI failed at the `pnpm install` step with:

  ENOENT: no such file or directory, open '.../patches/[email protected]'

Regenerated by diffing the pristine nuxt-workers 0.1.0 module.mjs (from the
npm registry tarball) against the already-patched copy in node_modules. The
3-line idempotency guard at dist/module.mjs:18 is preserved verbatim. Fresh
install from a clean node_modules produces the same _patch_hash=7cde39d... so
the patch contents match what pnpm-workspace.yaml expects.

Signed-off-by: Vinayak Kulkarni <[email protected]>

* fix(client): raise node heap for vite 8 + web-llm build

Vite 8.0.12 + Rolldown processes apps/client through vite:asset-import-meta-url
which runs strip-literal on every source file. The @mlc-ai/web-llm bundle is a
single 6.2 MB index.js with deeply nested template literals; the tokenizer that
strip-literal uses chews through V8's old-space heap and surfaces as

  RangeError: Maximum call stack size exceeded
    at module.exports (vite/.../node.js:18182)
    at stripLiteral

despite the symptom mentioning 'call stack'. Raising the heap ceiling to 16 GB
via NODE_OPTIONS=--max-old-space-size=16384 lets the tokenizer complete.

NODE_OPTIONS is the canonical Node.js env knob for memory tuning per
https://nodejs.org/learn/diagnostics/memory/understanding-and-tuning-memory
and it propagates cleanly through pnpm exec into the nuxt CLI. --stack-size
would be the equivalent stack flag but Node blocks it from NODE_OPTIONS so we
cannot use that path. Drop this once vite ships a strip-literal fix that does
not allocate proportionally to file size (tracking vitejs/vite#21696 followups).

Signed-off-by: Vinayak Kulkarni <[email protected]>

* refactor(deps): consolidate all workspace deps into catalogs, migrate to @tailwindcss/vite

Two coordinated changes that need to land together:

CATALOG CONSOLIDATION
Every dep in every workspace package.json now references a catalog. Before
this commit, four package.json files carried hardcoded versions that drifted
from the workspace single source of truth:

  - root: @commitlint/cli, @commitlint/config-conventional, husky, is-ci,
    lint-staged
  - apps/docs: @nuxt/content, better-sqlite3
  - benchmarks: autocannon, chalk, cli-table3, commander

Added matching entries to pnpm-workspace.yaml under catalogs.default for the
shared dev-tooling, plus two new named catalogs:
  - catalogs.docs   : @nuxt/content, better-sqlite3 (docs-only deps)
  - catalogs.benchmarks : autocannon, chalk, cli-table3, commander
    (benchmarks-only deps)

@TAILWINDCSS/POSTCSS -> @TAILWINDCSS/VITE
The Tailwind v4 postcss plugin produced ENOENT 'tailwindcss' on every SSR
build through Vite 8 because postcss-import was resolving the bare
@import 'tailwindcss'; before @tailwindcss/postcss could intercept it.
Both apps/docs and apps/marketing failed in their server bundle phase as a
result. The canonical Tailwind v4 + Vite integration is the
@tailwindcss/vite plugin which hooks into Vite directly and never round-
trips through postcss-import.

Swapped @tailwindcss/postcss with @tailwindcss/vite across client, docs and
marketing. Removed the now-orphaned 'postcss: { plugins: ... }' block from
each nuxt.config.ts and registered the plugin via vite.plugins[].

Verified locally: pnpm install + pnpm build all three apps -> exit 0,
dist/ artefacts written (Cloudflare Pages output for docs and marketing,
static .output for client).

Signed-off-by: Vinayak Kulkarni <[email protected]>

* refactor(client): replace nuxt-workers with native vite web workers

The nuxt-workers 0.1.0 package was effectively unmaintained (last release
Feb 2025) and shipped a buggy transform plugin that double-injected
'const __worker_exports__' under Vite 8's Rolldown bundler, crashing
pnpm build. We were carrying a 3-line pnpm patch to silence it
(patches/[email protected] + patchedDependencies entry in
pnpm-workspace.yaml) — fragile, blocks lockfile churn, locks us to a
dead dep.

Migrated to Vite's native Web Worker support — the recommended pattern
per https://vite.dev/guide/features.html#web-workers:

  const worker = new Worker(
    new URL('~/workers/parse-geojson.ts', import.meta.url),
    { type: 'module' },
  );
  return runWorker(worker, file.name, text);

Added apps/client/app/lib/run-worker.ts — a tiny ~50-line helper with
two exports:
  - runWorker(worker, ...args)        : main-thread promise wrapper
  - registerWorkerHandler(handler)    : worker-thread message listener

Each handler returns either { ok: true, result } or
{ ok: false, error }; the main side resolves or rejects the promise and
terminates the worker on first message. Errors propagate as real
Error objects.

Each parser worker (parse-geojson.ts, parse-csv.ts, parse-shapefile.ts)
calls registerWorkerHandler(parseFn) at the bottom; the typed result
interface is exported (ParseGeoJSONResult, ParseCSVResult,
ParseShapefileResult) so file-parsers.ts gets full type safety on the
main side via the Worker generics.

Removed:
  - 'nuxt-workers' from apps/client/nuxt.config.ts modules array
  - 'nuxt-workers' from apps/client/package.json deps
  - nuxt-workers entry from pnpm-workspace.yaml catalogs.client
  - patches/[email protected]
  - patchedDependencies block from pnpm-workspace.yaml

Verified: pnpm dev (HTTP 200 from :3000) + pnpm build (12 MB dist with
discrete worker chunks under _nuxt/) — both exit 0.

Signed-off-by: Vinayak Kulkarni <[email protected]>

* refactor(client): move worker rpc + parse result types to app/types/

Per CLAUDE.md Rule #1, every type definition must live in app/types/ — never
inline in composables, workers, library files, or components. Previous commit
042156a co-located WorkerSuccess / WorkerFailure / WorkerResponse inside
app/lib/run-worker.ts and ParseGeoJSONResult / ParseCSVResult /
ParseShapefileResult inside each app/workers/parse-*.ts file, which violates
the rule.

Moves:
  - WorkerSuccess, WorkerFailure, WorkerResponse  -> app/types/worker.ts (new)
  - ParseGeoJSONResult, ParseCSVResult, ParseShapefileResult -> appended to
    app/types/file-upload.ts (alongside the related ParsedFile,
    SupportedFormat, GeometryType)

Re-exported all six new types from app/types/index.ts barrel. Updated
run-worker.ts, all three parse-*.ts workers, and file-parsers.ts to import
the types instead of declaring them inline.

Verified: pnpm run build (client) -> exit 0, pnpm run lint -> 0 warnings,
0 errors.

Signed-off-by: Vinayak Kulkarni <[email protected]>

---------

Signed-off-by: Vinayak Kulkarni <[email protected]>
haex-space added a commit to haex-space/haex-vault-legacy that referenced this pull request May 16, 2026
… link (#267)

The vite:extendConfig hook added in 873fa87 to fix the Nuxt 4.4.5
"No entry found in rollupOptions.input" dev-mode crash also ran during
`nuxt generate`. Setting `rollupInput.server = firstInput` in the
production build silently drops `<link rel="stylesheet" href="/_nuxt/entry.*.css">`
from the prerendered index.html, so every release between v1.21 and v1.22
shipped without CSS on all platforms (Linux, Windows, macOS, Android).

Gate the hook to dev mode (NUXT_DEV / NODE_ENV=development) and to the
client environment. resolveServerEntry still gets the patched input it
needs, and the production bundle keeps its stylesheet link.

Refs: nuxt/nuxt#35033, nuxt/nuxt#35037 (fix merged, awaiting Nuxt 4.4.6).

Co-authored-by: Release Bot <[email protected]>
Aurorabili added a commit to Aurorabili/credchain that referenced this pull request May 17, 2026
davidstackio pushed a commit to davidstackio/nuxt that referenced this pull request May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.x 🐛 bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants