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

Enable Development builds #13548

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 9 additions & 5 deletions packages/react-scripts/scripts/build.js
Expand Up @@ -9,8 +9,8 @@
'use strict';

// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'production';
process.env.NODE_ENV = 'production';
process.env.NODE_ENV ||= 'production';
process.env.BABEL_ENV = process.env.NODE_ENV;

// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
Expand Down Expand Up @@ -55,7 +55,7 @@ const argv = process.argv.slice(2);
const writeStatsJson = argv.indexOf('--stats') !== -1;

// Generate configuration
const config = configFactory('production');
const config = configFactory(process.env.NODE_ENV);

// We require that you explicitly set browsers and do not fall back to
// browserslist defaults.
Expand Down Expand Up @@ -139,9 +139,13 @@ checkBrowsers(paths.appPath, isInteractive)
process.exit(1);
});

// Create the production build and print the deployment instructions.
// Create the build and print the deployment instructions.
function build(previousFileSizes) {
console.log('Creating an optimized production build...');
if (process.env.NODE_ENV === 'production') {
console.log('Creating an optimized production build...');
} else {
console.log(`Creating a ${process.env.NODE_ENV} build...`);
}

const compiler = webpack(config);
return new Promise((resolve, reject) => {
Expand Down