You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Dev server crashes when octane.config.ts imports decorator-using code (virtual module ids reach the file watcher) #988
Dev server crashes when octane.config.ts imports decorator-using code (virtual module ids reach the file watcher)
Summary
vite dies at startup with ERR_INVALID_ARG_VALUE if octane.config.ts transitively imports a module that uses TypeScript decorators. The oxc transform injects a helper as a rollup virtual module, whose id begins with a NUL byte. viteConfigModuleRunner().getDependencies() collects it as a config dependency and configureServer passes it to vite.watcher.add(), which cannot stat it.
TypeError [ERR_INVALID_ARG_VALUE]: The argument 'path' must be a string, Uint8Array, or URL without null bytes.
Received '/home/user/project/\x00@[email protected]/helpers/esm/decorate.js'
at Object.stat (node:fs:1977:10)
at NodeFsHandler._addToNodeFs (vite/dist/node/chunks/node.js:9780:51)
at FSWatcher.add (vite/dist/node/chunks/node.js:10446:23)
at BasicMinimalPluginContext.configureServer (@octanejs/vite-plugin/src/index.js:498:18)
Emitted 'error' event on FSWatcher instance
Cause
In src/load-config.js, the module-graph walk in viteConfigModuleRunner adds every module.file it sees:
if(module.file)dependencies.add(module.file);
Vite populates file for virtual modules too, keeping the \0 prefix. Those ids flow into compilerConfigWatchFiles via path.resolve(file) in index.js, and then into vite.watcher.add([...compilerConfigWatchFiles]).
Suggested fix
Filter virtual ids at the collection point, so both watcher call sites in index.js are covered:
- if (module.file) dependencies.add(module.file);+ if (module.file && !module.file.includes('\0')) dependencies.add(module.file);
Verified locally as a patch: dev server boots, and touching octane.config.ts still triggers a server restart.
Activity