@@ -358,6 +358,8 @@ Node.js supports the following conditions:
358358* ` "node" ` - matched for any Node.js environment. Can be a CommonJS or ES
359359 module file. _ This condition should always come after ` "import" ` or
360360 ` "require" ` ._
361+ * ` "development" ` - enabled by the ` --dev ` flag in Node.js, this allows code
362+ paths to be loaded that provide additional debugging information.
361363* ` "default" ` - the generic fallback that will always match. Can be a CommonJS
362364 or ES module file. _ This condition should always come last._
363365
@@ -383,6 +385,10 @@ Conditional exports can also be extended to exports subpaths, for example:
383385 " exports" : {
384386 " ." : " ./main.js" ,
385387 " ./feature" : {
388+ " development" : {
389+ " browser" : " ./feature-browser-dev.js" ,
390+ " default" : " ./feature-dev.js"
391+ },
386392 " browser" : " ./feature-browser.js" ,
387393 " default" : " ./feature.js"
388394 }
@@ -392,7 +398,8 @@ Conditional exports can also be extended to exports subpaths, for example:
392398
393399Defines a package where ` require('pkg/feature') ` and ` import 'pkg/feature' `
394400could provide different implementations between the browser and Node.js,
395- given third-party tool support for a ` "browser" ` condition.
401+ given third-party tool support for a ` "browser" ` condition, as well as
402+ loading different code between development and production environments.
396403
397404#### Nested conditions
398405
@@ -1471,8 +1478,8 @@ future updates.
14711478In the following algorithms , all subroutine errors are propagated as errors
14721479of these top - level routines unless stated otherwise .
14731480
1474- _defaultEnv_ is the conditional environment name priority array ,
1475- ` ["node", "import"] ` .
1481+ _defaultEnv_ is the conditional environment array , ` ["node", "import"] ` ,
1482+ including the ` "development" ` condition if the ` --dev ` flag is set .
14761483
14771484The resolver can throw the following errors :
14781485* _Invalid Module Specifier_ : Module specifier is an invalid URL , package name
0 commit comments