Closed muchisx closed 1 day ago
Hi! Thanks for creating the issue and sorry for the late response.
I've been checking this, but apparently Remix requires NODE_ENV=development
. I've tried to use the actual env var in https://github.com/Shopify/cli/pull/4350 (you can try it with npm i -g @shopify/cli@0.0.0-snapshot-20240820121935
), but I'm getting the same linked error...
Why do you need it to be production
?
Hi @gonzaloriestra ! thank you for the feedback!
We have internal tools that we gate via this env value, and we wanted to use Vite's mode to check they are properly being gated without the need to do a re-deploy on our hosting provider to check.
But it always comes up as development, I'll try with the snapshot thanks!, but as you said if remix can't even run with that flag set as production
then probably it wouldn't still be possible for us
I see, thanks! I'll ask internally to see if there's a way.
Sorry for the late response.
Apparently, vite:dev
is not compatible with NODE_ENV=production
. More info here: https://vitejs.dev/guide/env-and-mode.html#node-env-and-modes
In case it helps, you can follow the app template deployment docs for instructions on running it in production mode. You can ignore the word 'container' and apply everything locally.
@gonzaloriestra Gotcha, I might've missed where they mention vite:dev
not being compatible, no biggie, thank you for looking into it and the suggestions!
Please confirm that you have:
In which of these areas are you experiencing a problem?
App
Expected behavior
When setting a different
NODE_ENV
value via for example a.env
file. The value won't ever be taken into account because the CLI always hardcodes the value ofNODE_ENV
instead of defaulting to the value the user has set, or if any is set, then I see it okay to usedevelopment
as fallback.This is necessary for when testing different environments while local development before commiting code.
Actual behavior
The value used as
NODE_ENV
is alwaysdevelopment
regardless of what the user needs it to be.I have a feeling is related to this line ๐๐ผ https://github.com/Shopify/cli/blob/3ad543d74cba89a9746cd8a1b6420a0ff288bc85/packages/app/src/cli/services/dev/processes/web.ts#L133
Verbose output
Reproduction steps
NODE_ENV=production
in a.env
file.console.log(process.env.NODE_ENV)
anywhere in the appdevelopment
regardless of anything you doOperating System
Windows 11
Shopify CLI version (check your project's
package.json
if you're not sure)3.63.1
Shell
powershell
Node version (run
node -v
if you're not sure)20.11.1
What language and version are you using in your application?
Typescript