Skip to content

fix(vite-dev-server): apply server.fs check to env transport - #51

Merged
kazupon merged 1 commit into
mainfrom
fix/sync-vite-server-fs-env-transport
Sep 30, 2026
Merged

kazupon merged 1 commit into
mainfrom
fix/sync-vite-server-fs-env-transport

Conversation

@kazupon

@kazupon kazupon commented Sep 30, 2026

Copy link
Copy Markdown
Owner

Port vitejs/vite#22159, which moves the server.fs check for transformed ids into transformRequest() so that it also applies to env transports:

  • DevEnvironment.transformRequest() checks server.fs by default. HotChannel.skipFsCheck lets transports that are not exposed over the network opt out, and warmupRequest() skips the check as upstream does.
  • The client environment rejects fetchModule invocations (disableFetchModule).
  • The Worker transform RPC no longer passes allowId. The check now runs inside transformRequest() and still uses transformAccess.ts, which also checks the path without its query.
  • The preview MessageChannel server never skips the check.

The preview MessageChannel transport does not implement vite:invoke today, so fetchModule is not reachable from preview documents, and preview requests from the Service Worker are checked as before. This change keeps the check in place if invoke support is added later, and aligns transformRequest() with upstream.

Upstream tests cover SSR, module runners and playgrounds that this fork does not port, so unit tests cover the check, the per-transport opt-out, warmup requests, disabled fetchModule and the Worker RPC.

Validated with typecheck, lint, vp run test:unit:vite:node (649 → 657 tests) and the @vrowzer/vite-dev-server build. Integration and E2E tests were not run locally.

Port vitejs/vite#22159 (f02d9fde0). The server.fs check moves from the Worker transform RPC (allowId) into transformRequest(), still using transformAccess.ts, which also checks the path without its query. The preview MessageChannel server never skips the check, and the client environment rejects fetchModule invocations.

Upstream tests cover SSR, module runners and playgrounds that this fork does not port, so unit tests cover the check, the per-transport opt-out, warmup requests, disabled fetchModule and the Worker RPC instead.
@kazupon
kazupon merged commit 9d26c7a into main Sep 30, 2026
4 checks passed
@kazupon
kazupon deleted the fix/sync-vite-server-fs-env-transport branch September 30, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant