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

HMR does not work when specifying a port #5834

Closed
kentcdodds opened this issue Mar 16, 2023 · 5 comments
Closed

HMR does not work when specifying a port #5834

kentcdodds opened this issue Mar 16, 2023 · 5 comments
Assignees

Comments

@kentcdodds
Copy link
Member

I recorded a loom to demonstrate the issue: https://www.loom.com/share/b9a88877d0a642cdbe305605212d1695

I tried a bunch of different combinations and it just appears that if you specify a PORT environment variable or use the -p flag, HMR will not work.

@pcattori
Copy link
Contributor

pcattori commented Mar 16, 2023

Yea for unstable_dev, the PORT env var is vestigial. Should probably just ignore that env var for remix dev when using unstable_dev since its conflicting and causing weird stuff to happen.

Also adding better output for the dev server is on my list of things to do. Something like:

App server: localhost:4444
Dev server websocket port: 3001
Waiting for app server...

👆 to make it crystal clear what ports are being used and for what purpose.

That said, you should be able to use the --app-server-port and --port flags for remix dev (again, assuming unstable_dev is enabled). You probably don't care what port gets used for dev websocket, so just set --app-server-port=4444 to tell dev server where your app server is.

@kentcdodds
Copy link
Member Author

That's great! I'll give that a shot next time I get in front of the keyboard. I guess we can leave this open as an issue to document this in --help and also to ignore the PORT env var or something. Thanks!

@pcattori
Copy link
Contributor

Oh and I should mention that you can also set the app server port in remix.config.js:

module.exports = {
  unstable_dev: {
    appServerPort: 4444
  }
}

or via flag as mentioned previously. Your choice.

All configurable options are detailed in the release notes for v1.12.0, though still need to write up some better docs.

@kentcdodds
Copy link
Member Author

Awesome. I've also added port: '' to that config so it selects a random port instead of using the environment variable PORT.

@github-actions
Copy link
Contributor

🤖 Hello there,

We just published version v0.0.0-nightly-6295eb6-20230425 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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants