Replies: 1 comment
-
Think it's more a question for Instead of waiting and delaying (which Preloading .env can be done like this: node -r dotenv/config your_script.js dotenv_config_path=/custom/path/to/.env |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So I have a weird problem and I've been at it for a couple of hours but can't figure out the solution.
I have a Next.js app setup with a custom server,
Nothing fancy here,
/path/one/*
and/path/two/*
are the paths which needs to be proxied. And theproxyOneHandler
looks like:For the sake of brevity, assume
proxyTwoHandler
is similarly setup.Now the issue is,
HPM
starts the proxy before Next.js loads the env variables. Because of whichprocess.env.PROXY_PATH
is alwaysundefined
. I've pasted the startup logs below, as you can see,Loaded env from /Users/developer/project/.env
comes afterHPM
has created proxy.So essentially the question is, Is there a way to let
HPM
know to wait till Next.js is done loading? Maybe delaying it some way?Beta Was this translation helpful? Give feedback.
All reactions