Gezim
Gezim

Reputation: 7318

Next.js ignoring NODE_ENV=development

In my package.json, I have a build script set to build my next project as follows:

"build": "echo \"$NODE_ENV\" && NODE_ENV=$NODE_ENV next build && npm run build-server",

The output from the command that I get is:

> [email protected] build /usr/src/admin-ui
> echo "$NODE_ENV" && NODE_ENV=$NODE_ENV next build && npm run build-server

development
Creating an optimized production build ...

The echo outputs development as the value for $NODE_ENV. However, I cannot get that passed to next. It just ignores it.

Using next.js version 9.0.5.

Upvotes: 4

Views: 3311

Answers (1)

Ramakay
Ramakay

Reputation: 3135

next build generates production builds

next dev creates a development build - https://nextjs.org/docs/api-reference/cli#development

Build usually is nomenclature for production builds and dev for a development server.

When you do next build it assumes that its preparing for production and continues to do so.

Upvotes: 0

Related Questions