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
I want to set a particular config setting to a different value when I'm running yarn dev. Ideally, I'd be able to call isDev inside nuxt.config.js, but I don't have the context nor helper available. #6420 suggests checking NODE_ENV but that's not a viable strategy - there are other situations where NODE_ENV will be set to development, for example this is what Netlify does by default. I've looked at other env variables available, but I haven't found anything that would be nuxt specific and a good indicator of running under a dev server.
My current workaround is to add a RUNNING_A_DEV_SERVER=1 kind of variable to the dev script in package.json and check for that via process.env in the config. As you can probably guess, I'd prefer something less brittle, that will not depend on me setting that variable.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I want to set a particular config setting to a different value when I'm running
yarn dev
. Ideally, I'd be able to callisDev
insidenuxt.config.js
, but I don't have the context nor helper available. #6420 suggests checkingNODE_ENV
but that's not a viable strategy - there are other situations whereNODE_ENV
will be set todevelopment
, for example this is what Netlify does by default. I've looked at other env variables available, but I haven't found anything that would be nuxt specific and a good indicator of running under a dev server.My current workaround is to add a
RUNNING_A_DEV_SERVER=1
kind of variable to thedev
script inpackage.json
and check for that viaprocess.env
in the config. As you can probably guess, I'd prefer something less brittle, that will not depend on me setting that variable.Beta Was this translation helpful? Give feedback.
All reactions