fix(pack-up): set NODE_ENV if it's not already set (#18583)

This commit is contained in:
Josh 2023-10-26 12:10:07 +01:00 committed by GitHub
parent 5daf92f107
commit d9554abef3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,6 +33,13 @@ interface BuildWithoutConfigFile extends BuildCLIOptions {
type BuildOptions = BuildWithConfigFile | BuildWithoutConfigFile;
const build = async (opts: BuildOptions = {}) => {
/**
* We always want to run in production mode when building and some packages
* use NODE_ENV to determine which type of package to import (looking at your react).
* Therefore for building, unless it's specifically set by the user, we'll set it to production.
*/
process.env.NODE_ENV = process.env.NODE_ENV || 'production';
const {
silent,
debug,