-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Type error when importing server build from server.ts
#8343
Comments
Hey @pcattori I think this has been introduced in the latest 2.4.0 release of |
I'm not sure there's an alternative here. In a fresh project when running the dev server before running the build, |
Doesn't look great, but it works: app.all('*', async (request, reply) => {
try {
const handler = createRequestHandler({
// https://github.com/remix-run/remix/issues/8343#issuecomment-1867179525
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore - expected type mismatch
build: vite
? () => vite.ssrLoadModule('virtual:remix/server-build')
: // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore - expected non-existent file (pre-build)
await import('../../build/server'),
});
return handler(request, reply);
} catch (error) {
captureException('could not render request', error, {
url: request.url,
});
return reply.status(500).send(error);
}
}); |
Yeah, is there any specific reason for not using @ts-expect-error directly instead of needing two comments? |
Because |
I think the first use of |
server.ts
Changed the title and removed the Vite tag since this has always been the case with Remix server builds, even with the classic compiler. Definitely something I'm keen to improve, but just not directly related to Vite. |
Thank you for checking this out @pcattori you are the man, I really appreciate you! If there's anything I can do to contribute, I'd be keen to! |
Hey, I have the same issue. My use-case is to lint with Is there any timeline for that? |
Reproduction
https://stackblitz.com/edit/remix-run-remix-2pvj8y?file=server.ts
System Info
Used Package Manager
npm
Expected Behavior
Clean TS slate
Actual Behavior
When I add to custom TS server setup:
The text was updated successfully, but these errors were encountered: