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

Remix 1.16.0 new dev server prematurely exits incorrectly #6268

Closed
1 task done
aniravi24 opened this issue May 1, 2023 · 12 comments · Fixed by #6477
Closed
1 task done

Remix 1.16.0 new dev server prematurely exits incorrectly #6268

aniravi24 opened this issue May 1, 2023 · 12 comments · Fixed by #6477

Comments

@aniravi24
Copy link

aniravi24 commented May 1, 2023

What version of Remix are you using?

1.16.0

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

  • Yes

Steps to Reproduce

Run the dev server with the future flag in remix.config.js and run remix dev (and optionally run with a custom command -c flag).

future: { unstable_dev: true }

Expected Behavior

Properly detect dependencies at the root of a monorepo. and also handle custom commands without expecting @remix-run/serve to be present.

Actual Behavior

Two separate issues:

  1. The detection of @remix-run/serve within a pnpm nx monorepo setup doesn't work correctly. My project has a single package.json at the root of the workspace and my app lives under a directory like packages/remix-app. When I comment out the code below that causes the exit, it runs perfectly fine, so I know it's a detection issue.
  2. When a custom command is passed in, it exits if it fails to detect @remix-run/serve because it appears to ignore the custom command for some reason (possible that it's somehow not getting passed in, but it looks like I am).

Lines of code causing the issue are here:
https://github.com/remix-run/remix/blob/main/packages/remix-dev/cli/commands.ts#L543

@pcattori
Copy link
Contributor

pcattori commented May 1, 2023

@aniravi24 can you elaborate about (2)? What error are you seeing?

@aniravi24
Copy link
Author

aniravi24 commented May 1, 2023

@aniravi24 can you elaborate about (2)? What error are you seeing?

(2) might be caused by Nx actually, cause running npx remix dev with the -c flag is working correctly. Doing more investigation! My other Nx commands that use flags work fine though, which is odd..

@aniravi24
Copy link
Author

aniravi24 commented May 3, 2023

@aniravi24 can you elaborate about (2)? What error are you seeing?

Looks like it did have something to with Nx, it no longer happens. I fix the first problem now by passing in remix-serve build manually with the -c flag, which I'm fine with doing.

@pcattori
Copy link
Contributor

pcattori commented May 3, 2023

Ok so (2) is purely an NX thing. But (1) should still work out of the box for pnpm, so that's still a bug that should be fixed.

@pcattori
Copy link
Contributor

pcattori commented May 5, 2023

@aniravi24 does running pnpm list from the root of your project and from packages/remix-app show remix-serve as a dependency?

Trying to determine a reliable way to detect if remix-serve is installed in a pnpm project.

@aniravi24
Copy link
Author

aniravi24 commented May 5, 2023

@aniravi24 does running pnpm list from the root of your project and from packages/remix-app show remix-serve as a dependency?

Trying to determine a reliable way to detect if remix-serve is installed in a pnpm project.

I do see @remix-run/serve when running pnpm list from the root of my monorepo, not from inside packages/remix-app though because no packages are listed inside of there, and I don't use pnpm workspaces.

I have a single package.json at the root of my monorepo to manage dependencies for all projects that live in the monorepo, including those under packages/.

I don't think this is a pnpm specific problem (but I mentioned it just for context), as I could imagine my setup with yarn or npm would probably would exhibit the same behavior, since I'm not using the workspaces functionality of any package manager to manage my packages.

I'm not super familiar with module resolution, but I think the reason this setup can work with the typical module resolution algorithm is that it walks up your directory tree until it finds the first directory with a package.json/node_modules? Not sure if there's a way to use this same mechanism in code to say "if this module is importable, it means it does exist"

@rodbs
Copy link

rodbs commented May 25, 2023

I have the same issue with Remix 1.16.1 in a pnpm monrepo (without Nx)
Error: remix dev is not supported for custom servers.
Is there a way to fix it? thx

@pcattori
Copy link
Contributor

@rodbs the old dev server (unstable_dev disabled) does not support custom servers. So if you are using a custom server.js (or whatever you have set as serverEntryPoint in your remix.config.js), you can't use remix dev. The alternate setup for legacy dev server is to use remix watch instead for live reload.

If on the other hand, you have unstable_dev enabled, then that would be a bug in Remix.

@rodbs
Copy link

rodbs commented May 25, 2023

@pcattori Thanks, I had unstable_dev disabled. When enabling it, it works!!

@github-actions
Copy link
Contributor

🤖 Hello there,

We just published version v0.0.0-nightly-21504cf-20230526 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!

@github-actions
Copy link
Contributor

github-actions bot commented Jun 2, 2023

🤖 Hello there,

We just published version 1.17.0-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!

@github-actions
Copy link
Contributor

github-actions bot commented Jun 6, 2023

🤖 Hello there,

We just published version 1.17.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!

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.

4 participants