Skip to content

NODE_ENV not set on process.env #2362

@okonet

Description

@okonet

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

Currently, mode only sets the value for NODE_ENV in the DefinePlugin but not changes the process.env.NODE_ENV.

For example, Babel depends on this env variable and when used with webpack --mode=production it will still run in development mode.

If the current behavior is a bug, please provide the steps to reproduce.

Running webpack --silent --mode=production && echo $NODE_ENV

This will NOT print anything.

Run NODE_ENV=production && webpack --silent --mode=production && echo $NODE_ENV

This will print production

What is the expected behavior?

Running webpack --silent --mode=production && echo $NODE_ENV should print production

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions