Skip to content
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

Removing entry.client & entry.server causes remix dev to hang #5669

Closed
1 task done
jgentes opened this issue Mar 5, 2023 · 6 comments · Fixed by #5681
Closed
1 task done

Removing entry.client & entry.server causes remix dev to hang #5669

jgentes opened this issue Mar 5, 2023 · 6 comments · Fixed by #5681
Assignees

Comments

@jgentes
Copy link

jgentes commented Mar 5, 2023

What version of Remix are you using?

1.14.0

Are all your remix dependencies & dev-dependencies using the same version?

  • Yes

Steps to Reproduce

Just testing the ability to use default client/server entry files. When I remove them, Remix installs isbot to my dependencies (would be nice to know why, otherwise it may get removed accidentally in the future) and hangs on yarn dev. Here's the console log from when it ran normally, then started failing after removing the client/server files:

image

My entry.client.tsx:

import { RemixBrowser } from '@remix-run/react'
import { hydrate } from 'react-dom'

hydrate(<RemixBrowser />, document)

My entry.server.tsx:

import type { EntryContext } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'

const handleRequest = (
  request: Request,
  responseStatusCode: number,
  responseHeaders: Headers,
  remixContext: EntryContext
) => {
  const markup = renderToString(
    <RemixServer context={remixContext} url={request.url} />
  )

  responseHeaders.set('Content-Type', 'text/html; charset=utf-8')
  //responseHeaders.set('Cross-Origin-Embedder-Policy', 'require-corp')
  //responseHeaders.set('Cross-Origin-Opener-Policy', 'same-origin')

  return new Response(`<!DOCTYPE html>${markup}`, {
    status: responseStatusCode,
    headers: responseHeaders,
  })
}

export default handleRequest

Expected Behavior

Remix should run properly without client/server entry files.

Actual Behavior

See above

@jgentes jgentes changed the title Removing entry.client & entry.server causes yarn dev to hang Removing entry.client & entry.server causes remix dev to hang Mar 5, 2023
@huw
Copy link
Contributor

huw commented Mar 7, 2023

To answer the isbot question, the default Remix entry.server.tsx file now includes isbot to determine whether to stream the response or immediately render it. This is new to recent versions of the templates, which use React Streaming SSR. If you created your project on an older version of the template you wouldn’t have that setup.

@mcansh
Copy link
Collaborator

mcansh commented Mar 8, 2023

To answer the isbot question, the default Remix entry.server.tsx file now includes isbot to determine whether to stream the response or immediately render it. This is new to recent versions of the templates, which use React Streaming SSR.

bingo!

@mcansh
Copy link
Collaborator

mcansh commented Mar 8, 2023

based on your entry files, it appears you're using react 17, is that correct? if so, that's unfortunately unsupported with optional entries currently, but #5681 will bring that to you soon

@jgentes
Copy link
Author

jgentes commented Mar 8, 2023

Got it, sorry I missed the React 18 requirement - I'll look at updating or try with the upcoming fix - thanks!

@jgentes jgentes closed this as completed Mar 8, 2023
@mcansh mcansh linked a pull request Mar 10, 2023 that will close this issue
2 tasks
@jgentes
Copy link
Author

jgentes commented Mar 13, 2023

I'm happy to report that upgrading to React 18 (and updating Emotion) did the trick. Removing the client and server entry files worked as expected, thanks!

@github-actions
Copy link
Contributor

🤖 Hello there,

We just published version v0.0.0-nightly-d6c9737-20230322 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants