Completely updated React, fixed #11, (hopefully)

This commit is contained in:
2018-03-04 19:11:49 -05:00
parent 6e0afd6e2a
commit 34e5f5139a
13674 changed files with 333464 additions and 473223 deletions

View File

@@ -7,6 +7,9 @@
const DefinePlugin = require("./DefinePlugin");
const needsEnvVarFix = ["8", "9"].indexOf(process.versions.node.split(".")[0]) >= 0 &&
process.platform === "win32";
class EnvironmentPlugin {
constructor(keys) {
if(Array.isArray(keys)) {
@@ -23,6 +26,13 @@ class EnvironmentPlugin {
apply(compiler) {
const definitions = this.keys.reduce((defs, key) => {
// TODO remove once the fix has made its way into Node 8.
// Work around https://github.com/nodejs/node/pull/18463,
// affecting Node 8 & 9 by performing an OS-level
// operation that always succeeds before reading
// environment variables:
if(needsEnvVarFix) require("os").cpus();
const value = process.env[key] !== undefined ? process.env[key] : this.defaultValues[key];
if(value === undefined) {