You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's no easy way to tell whether the command is running in dev or not.
I could assume production production unless a certain environment variable exists, but that's not a great idea. It would require devs to set an environment variable (globally or when running the CLI on any machine) and if they forget, they might run something bad on a branch and it'll interact with production servers.
This is my current workaround; environment.js:
/* In production, commands are each bundled into a single file; e.g. /build/commands/index.js. That's why the following will be false in production*/constisDev=__filename.endsWith("environment.js");exportdefaultObject.freeze({
isDev
});
I use this in my commands/components to check if it's dev/prod
I suggest pastel sets process.env.NODE_ENV or something like that.
The text was updated successfully, but these errors were encountered:
That's a good catch, will need to think how to approach this.
vadimdemedes
changed the title
Feature request: expose whether the command is running in dev or prod
Expose whether the command is running in dev or prod
May 24, 2023
There's no easy way to tell whether the command is running in dev or not.
I could assume production production unless a certain environment variable exists, but that's not a great idea. It would require devs to set an environment variable (globally or when running the CLI on any machine) and if they forget, they might run something bad on a branch and it'll interact with production servers.
This is my current workaround; environment.js:
I use this in my commands/components to check if it's dev/prod
I suggest pastel sets
process.env.NODE_ENV
or something like that.The text was updated successfully, but these errors were encountered: