title: Next.js build does not use .env.development
body: <p>I would like to set up two different builds for a next.js application.</p>
  <p>package.json:</p>
  <pre class="lang-json prettyprint-override"><code>...
  &quot;scripts&quot;: {
    &quot;dev&quot;: &quot;next dev&quot;,
    &quot;debug&quot;: &quot;cross-env NODE_OPTIONS='--inspect' next dev&quot;,
    &quot;build:dev&quot;: &quot;set NODE_ENV=development &amp;&amp; next build&quot;,
    &quot;build:prod&quot;: &quot;set NODE_ENV=production &amp;&amp; next build&quot;,
    &quot;start&quot;: &quot;node server.js&quot;
  },
  &quot;dependencies&quot;: {
    &quot;bootstrap&quot;: &quot;^5.0.0-beta3&quot;,
    &quot;lodash&quot;: &quot;^4.17.21&quot;,
    &quot;next&quot;: &quot;^10.0.0&quot;,
    &quot;react&quot;: &quot;17.0.1&quot;,
    &quot;react-dom&quot;: &quot;17.0.1&quot;,
    &quot;react-scrollspy&quot;: &quot;^3.4.3&quot;,
    &quot;sass&quot;: &quot;^1.32.11&quot;
  },
  &quot;devDependencies&quot;: {
     &quot;cross-env&quot;: &quot;^7.0.3&quot;
  }
  ...
  </code></pre>
  <p>Then I created <code>.env.development</code> and <code>.env.production</code> with different hostname and port, like this:</p>
  <pre class="lang-env prettyprint-override"><code>HOST=127.0.0.3
  PORT=9999
  API_DOMAIN=http://$HOST:$PORT/API
  </code></pre>
  <p>But if I run <code>npm run build:dev</code> it displays this:</p>
  <pre><code>$ npm run build:dev
  
  &gt; learn-starter@0.1.0 build:dev
  &gt; set NODE_ENV=development &amp;&amp; next build
  
  warn  - You are using a non-standard &quot;NODE_ENV&quot; value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env
  info  - Loaded env from W:\web\projects\xfb\xfbweb\react\.env.production
  info  - Using webpack 4. Reason: future.webpack5 option not enabled https://nextjs.org/docs/messages/webpack5
  info  - Checking validity of types...
  info  - Creating an optimized production build...
  info  - Compiled successfully
  info  - Collecting page data...
  FetchError: request to http://127.0.0.3:9999/API/GET/blog/?mode_cd=summary&amp;offset=1&amp;limit=2&amp;language_cd=eng failed, reason: connect ECONNREFUSED 127.0.0.3:9999
  ...
  </code></pre>
  <p>It seems this uses the <code>.env.production</code>. How can I force this to use the <code>.env.development</code> in this case?<br />
  By the way, if i run <code>npm run build:prod</code> it also uses the <code>.env.production</code>.<br />
  I tried to update next to v12.1.0 but still do the same.</p>