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

[BUG]: Remix watch command forces NODE_ENV to development #6841

Closed
1 task done
jaidetree opened this issue Jul 14, 2023 · 5 comments · Fixed by #7117
Closed
1 task done

[BUG]: Remix watch command forces NODE_ENV to development #6841

jaidetree opened this issue Jul 14, 2023 · 5 comments · Fixed by #7117

Comments

@jaidetree
Copy link
Contributor

jaidetree commented Jul 14, 2023

What version of Remix are you using?

1.18

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

  • Yes

Steps to Reproduce

  1. Create a remix app using the express adapter
  2. Run NODE_ENV=test remix watch
  3. In a remix loader in root.tsx, add console.log(process.env.NODE_ENV)
  4. In express, log process.env.NODE_ENV
  5. Run the express app with NODE_ENV=test node server.js (or whichever command starts the server)

Hit a remix route and see what gets logged.

Expected Behavior

  • Express will print test
  • The Remix route will also print test

Actual Behavior

  • Express will print test
  • The Remix route will print development.

I traced it down and it seems the issue stems from the liveReload server used by the watch command:

  1. The watch command calls devServer.liveReload(config);
    devServer.liveReload(config);
  2. Which then calls await watch(...)
  3. Which forces the mode\env var
@pcattori pcattori self-assigned this Jul 14, 2023
@jaidetree
Copy link
Contributor Author

I'm open to fix it provided a maintainer\contributor gives me the greenlight to create a PR.

@pcattori
Copy link
Contributor

@jaidetree 🟢

@pcattori
Copy link
Contributor

pcattori commented Aug 9, 2023

Fixed by #7117

@pcattori pcattori closed this as completed Aug 9, 2023
@jaidetree
Copy link
Contributor Author

Ack! I knew there was something I forgot to do 😅 Thank you!!

@github-actions
Copy link
Contributor

🤖 Hello there,

We just published version v0.0.0-nightly-b1149bb-20230810 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
No open projects
Status: Closed
Development

Successfully merging a pull request may close this issue.

3 participants