cli: --dev flag for development exports resolution condition
This implements a node --dev
flag which sets the "development"
resolution condition in package exports.
This is based on feedback from the previous PR at https://github.com/nodejs/node/pull/32869, with the following changes:
-
process.env.NODE_ENV
is no longer the switch - meaning existing usage ofprocess.env.NODE_ENV
will not alter resolution making this backwards compatible and opt-in. - The
"production"
condition is no longer set making the focus on workflows that alter their behaviour in development as opposed to for production, avoiding the problem of users forgetting to set production options.
Node.js supporting "development"
in exports resolution will help bundlers and other tools to use this condition as well in their environments. This may well happen regardless of whether Node.js adopts this approach, but having a universal support for the feature would be a huge benefit to the ecosystem as a whole.
@nodejs/modules-active-members
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines