Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 766465a

Browse files
committedApr 30, 2020
remove env var
1 parent 3dce9ec commit 766465a

File tree

5 files changed

+11
-18
lines changed

5 files changed

+11
-18
lines changed
 

‎doc/api/cli.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ added: REPLACEME
134134

135135
> Stability: 1 - Experimental
136136
137-
Enables the `"development"` [conditional export][] in package resolution,
138-
while also setting `process.env.NODE_ENV` to `"development"`.
137+
Enables the `"development"` [conditional export][] in package resolution.
139138

140139
### `--disable-proto=mode`
141140
<!--YAML

‎doc/node.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ File name of the V8 CPU profile generated with
101101
.Fl -cpu-prof
102102
.
103103
.It Fl -dev
104-
Sets the development exports resolution and NODE_ENV environment variable.
104+
Enables the development mode conditional exports resolution.
105105
.
106106
.It Fl -disable-proto Ns = Ns Ar mode
107107
Disable the `Object.prototype.__proto__` property. If

‎lib/internal/bootstrap/pre_execution.js

-3
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,6 @@ function initializeReport() {
174174
}
175175

176176
function setupDebugEnv() {
177-
if (getOptionValue('--dev')) {
178-
process.env.NODE_ENV = 'development';
179-
}
180177
require('internal/util/debuglog').initializeDebugEnv(process.env.NODE_DEBUG);
181178
if (getOptionValue('--expose-internals')) {
182179
require('internal/bootstrap/loaders').NativeModule.exposeInternals();

‎test/fixtures/es-module-loaders/loader-with-custom-condition.mjs

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ const dev = process.env.NODE_ENV === 'development';
44

55
export async function resolve(specifier, context, defaultResolve) {
66
ok(Array.isArray(context.conditions), 'loader receives conditions array');
7-
deepStrictEqual([...context.conditions].sort(),
8-
['import', 'node', ...dev ? ['development'] : []]);
7+
deepStrictEqual(
8+
[...context.conditions].filter(c => c !== 'development').sort(),
9+
['import', 'node']
10+
);
911
return defaultResolve(specifier, {
1012
...context,
1113
conditions: ['custom-condition', ...context.conditions],

‎test/fixtures/pkgexports-dev.mjs

+5-10
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
import { fileURLToPath } from 'url';
22
import { createRequire } from 'module';
3-
import { strictEqual } from 'assert';
3+
import { strictEqual, AssertionError } from 'assert';
44

55
const require = createRequire(fileURLToPath(import.meta.url));
6-
7-
const expectValue =
8-
process.env.NODE_ENV === 'development' ? 'development' : 'production';
9-
10-
strictEqual(require('pkgexports-dev'), expectValue);
6+
const requireVal = require('pkgexports-dev');
117

128
(async () => {
13-
const { default: value } = await import('pkgexports-dev');
14-
strictEqual(value, expectValue);
15-
16-
console.log(expectValue);
9+
const { default: importVal } = await import('pkgexports-dev');
10+
strictEqual(requireVal, importVal);
11+
console.log(importVal);
1712
})();

0 commit comments

Comments
 (0)
Please sign in to comment.