-
-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug(vite): ENOENT: no such file or directory, open '/__skip_vite/.nuxt/components/nuxt-error.vue' #734
Comments
<attention attracted> |
Same issue here ! |
@danielroe Looks like this was broken in your PR #724, are there any plans to fix it? |
For sure! Equally, you should feel free to submit a PR if you get to it before I do. 🙏 |
I didn't dive deeply but it's interesting for me, why it's working in Nuxt3. Also I'm curious about the origins of __skip_vite prefix 🫨 |
@danielroe I'm not familiar enough with the codebase however I did come up with a nasty workaround for the time being that others are free to use: defineNuxtModule({
meta: {
name: 'SkipViteFix',
},
setup(_options, nuxt) {
let cachedViteServer: ViteDevServer | null = null;
nuxt.hook('vite:serverCreated', async (viteServer) => {
cachedViteServer = viteServer;
});
nuxt.hook('server:devHandler', () => {
const viteServer = cachedViteServer;
if (!viteServer) {
console.error('No vite dev server');
return;
}
let insertionPoint = viteServer.middlewares.stack.findIndex(
(m) =>
m.handle instanceof Function &&
m.handle.name === 'viteTransformMiddleware'
);
if (insertionPoint == -1) {
console.error('Invalid middleware insertion point ' + insertionPoint);
return;
}
viteServer.middlewares.stack.splice(insertionPoint, 0, {
route: '',
handle: (
req: IncomingMessage & { _skip_transform?: boolean },
_res: ServerResponse,
next: (err?: any) => void
) => {
// remove /__skip_vite/ from the URL
if (req.url && req.url.includes('/__skip_vite/')) {
const newUrl = req.url.replace('/__skip_vite/', '/');
req.url = newUrl;
}
next();
},
});
});
},
}) |
Workaround for nuxt/bridge#734
Workaround for nuxt/bridge#734
Environment
Linux
(via Windows 11 WSL)v16.19.0
(also tested Node 18)2.16.3
2.3.2
[email protected]
vite
bridge
,nitro
,serverHandlers
,devServerHandlers
,devServer
,typescript
,buildModules
-
()
,@nuxt/[email protected]
Reproduction
https://github.com/AndreyYolkin/nuxt-bridge-skip-vite
https://codesandbox.io/p/sandbox/frosty-leftpad-cn0sgz
Run
npm run dev
or open the Sandbox linkDescribe the bug
In dev mode, Nuxt built-in files are not loading in a propper way, which causes ENOENT on server
Additional context
It remembers this issue: #649
"Literally no one cares, but I get annoyed by anything" - magic string to attract attention)
Logs
The text was updated successfully, but these errors were encountered: