What's happening
The npm script build command cannot modify NODE_ENV
What should happen
"build:dev": "dotenv -e .env.development craco build" or "build:dev": "cross-env NODE_ENV=development craco build"
NODE_ENV should be development
packages/craco/src/scripts/build.ts this file
import type { BaseContext } from '@craco/types';
process.env.NODE_ENV = 'production'; // This line kills the ENV
import { findArgsFromCli } from '../lib/args';
craco sets NODE_ENV as production to generate an optimized build. You should be able to use a custom variable here.
PS: custom variables require REACT_APP as prefix to work i.e. REACT_APP_PROJECT_ENV
What's happening The npm script build command cannot modify NODE_ENV
What should happen "build:dev": "dotenv -e .env.development craco build" or "build:dev": "cross-env NODE_ENV=development craco build" NODE_ENV should be development
packages/craco/src/scripts/build.ts this file
CRACO version 7.0.0