vite dev server: /ns/m doesn't decode percent-encoded filenames (bracketed route files 404)
Summary
In dev-session (HTTP ESM) mode, modules fetched through the /ns/m/* endpoint 404 when the on-disk filename contains characters that the device's HTTP layer percent-encodes — e.g. [ and ] used by file-based router params (app/demo/[id].tsrx).
The same file serves fine when requested with raw (unencoded) brackets, so the lookup is using the encoded path literally instead of decoding it first.
Repro
- Any app with a source file containing brackets (a router dynamic segment such as
src/app/demo/[id].tsrx). ns run ios(dev server on :5173).- Compare:
curl --globoff 'http://localhost:5173/ns/m/packages/app/src/app/demo/[id].tsrx'→ 200curl 'http://localhost:5173/ns/m/packages/app/src/app/demo/%5Bid%5D.tsrx'→ 404
Observed
Device boot log at app launch:
NativeScript: module graph walk missed http://<host>:5173/ns/m/packages/app/src/app/demo/[id].tsrx?import — falling back to a blocking synchronous fetch. This should not happen; please report it.
Dynamic import error: Error: Instantiation failed (http-loader): http://<host>:5173/ns/m/src/index.ts — Uncaught Error: HTTP import failed: http://<host>:5173/ns/m/packages/app/src/app/demo/[id].tsrx?import (status=404)
[ns-entry] deterministic dev session bootstrap failed Error: Instantiation failed ...The dev session still boots and HMR works, so it's non-fatal — but the lazy/prefetched route module never loads (and the log says 'should not happen').
Expected
/ns/m decodes req.url (decodeURIComponent on the pathname) before resolving it to a filesystem path, so encoded and raw spellings hit the same module.
Environment
@nativescript/vitevians9.1.1 /@nativescript/core9.1.2- vite 8.3.0 (rolldown)
- iOS simulator, macOS
Source: NativeScript/NativeScript