Closed okalil closed 4 months ago
I would expect entry.server.tsx to contain the code that generates a static index.html file
That's exactly what it does π. In order to generate the index.html
file, Remix has pre-renders your /
route during the build on the server - so it needs a server build and a server entry to handle that build-time Request
. Once generated, the server build is removed. You are also free to remove the entry.server
file if you have no need to customize it.
There's a note on this in the docs:
It's important to note that Remix SPA mode generates your index.html file by performing a "pre-render" of your root route on the server during the build. This means that while you're creating a SPA, you still have a "server build" and "server render" step, so you do need to be careful about using dependencies that reference client-only aspects such as document, window, localStorage, etc.
@brophdawg11 I think I didn't describe the problem well. I understand that Remix pre renders the index route to generate the static html; the issue is that if I delete that entry.server
(that does the pre render), and run remix reveal
to generate it again, I actually get the entry.server
that is used for SSR apps.
Ah - ok yeah that's expected at the moment because remix reveal
does not have access to the resolved remix plugin options inside the vite
config so it can't determine if it's in SPA mode or not. Both of them work fine - the complex one and the simple one, so you can always go grab the simplified implementation from https://github.com/remix-run/remix/blob/main/packages/remix-dev/config/defaults/entry.server.spa.tsx if needed
Yes, at the moment, all of the Remix CLI commands require the remix.config.js file to work. That's what I have in my remix-vite-template
since I use remix-flat-routes
and wanted to be able to run remix routes
.
It hadn't occurred to me that this also impacts remix routes
which is a bit of a bigger miss than remix reveal
since the latter still reveals a working file (albeit a bit more complex one) - but remix routes
is just incorrect. Because of the routes impact we're going to fix our CLI to be vite-config aware, which will allow reveal
to be aware of the internals of the vite config. We're tracking the npx remix routes
work in https://github.com/remix-run/remix/issues/8845 and I'm going to re-open this to get the npx remix reveal
stuff fixed π
π€ Hello there,
We just published version 2.8.1-pre.0
which involves this issue. If you'd like to take it for a test run please try it out and let us know what you think!
Thanks!
π€ Hello there,
We just published version 2.8.1
which involves this issue. If you'd like to take it for a test run please try it out and let us know what you think!
Thanks!
Reproduction
npx create-remix@latest --template remix-run/remix/templates/spa
entry.server.tsx
andentry.client.tsx
filesremix reveal
System Info
Used Package Manager
npm
Expected Behavior
Since
ssr
is set tofalse
invite.config.ts
, I would expectentry.server.tsx
to contain the code that generates a static index.html file.Actual Behavior
An
entry.server.tsx
for SSR is generated.