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

Can we have environment NODE_ENV=development #2529

Closed
titellergetlinks opened this issue Jul 11, 2017 · 3 comments · May be fixed by blubfoo/next.js#354, blubfoo/next.js#355, phocks/next.js#38, phocks/next.js#39 or RiftNemesis/next.js#361

Comments

@titellergetlinks
Copy link

package.json

"scripts": {
  "dev": "node server.js",
  "build": "next build",
  "start": "NODE_ENV=production node server.js",
  "start-dev": "NODE_ENV=development node server.js"
}

server.js

const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })

I have 2 server (development and production) but i want development work like a production but database different.

If dev is true the server will build every time when tester come to the website but i want to push process.env.NODE_ENV=development like a process.env.NODE_ENV=production.

@frol
Copy link
Contributor

frol commented Jul 11, 2017

You can just use another environment variable for that, don't you? Leave NODE_ENV for Node and build purposes and use CONFIG to select the config presets.

@titellergetlinks
Copy link
Author

@frol Thank for reply my issue.

I have used another environment variable get undefined from browser (client-side) but on server side, I can get that environment variable.

I have used with-universal-configuration but result is the same.

@frol
Copy link
Contributor

frol commented Jul 11, 2017

@titellergetlinks with-universal-configuration is the right approach for your problem, and it works for me, so experiment more with it and get back with a specific question and/or code snippet which doesn't work for you. In any case, given this is not a bug, I suggest we move the further discussion to stackoverflow: https://stackoverflow.com/questions/tagged/next.js

@lock lock bot locked as resolved and limited conversation to collaborators May 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.