From 1184cbd271a0bed309a960c1be5a4fb22e42410c Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Mon, 8 Jan 2018 11:48:38 +0100 Subject: [PATCH] chore(distro): apply envify transform --- package-lock.json | 10 ++++++++++ package.json | 1 + tasks/bundle.js | 9 ++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 2964f3c2..0a92b8a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2098,6 +2098,16 @@ "integrity": "sha1-6WQhkyWiHQX0RGai9obtbOX13R0=", "dev": true }, + "envify": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/envify/-/envify-4.1.0.tgz", + "integrity": "sha512-IKRVVoAYr4pIx4yIWNsz9mOsboxlNXiu7TNBnem/K/uTHdkyzXWDzHCK7UTolqBbgaBz0tQHsD3YNls0uIIjiw==", + "dev": true, + "requires": { + "esprima": "4.0.0", + "through": "2.3.8" + } + }, "error-ex": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", diff --git a/package.json b/package.json index cca898b1..0b8f93c8 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "cpx": "^1.5.0", "del": "^3.0.0", "del-cli": "^1.1.0", + "envify": "^4.1.0", "eslint": "^4.14.0", "eslint-plugin-mocha": "^4.9.0", "jsondiffpatch": "^0.1.26", diff --git a/tasks/bundle.js b/tasks/bundle.js index 2fc7714f..44905cc4 100644 --- a/tasks/bundle.js +++ b/tasks/bundle.js @@ -8,7 +8,8 @@ var browserify = require('browserify'), flattenBundle = require('browser-pack-flat/plugin'), commonShake = require('common-shakeify'), unassertify = require('unassertify'), - uglify = require('uglify-es'); + uglify = require('uglify-es'), + envify = require('envify'); var pkg = require('../package'); @@ -127,6 +128,9 @@ function bundle(dest, variant, entry, done) { timer.start('build prod'); browserify(browserifyOptions) + .transform(envify, { + NODE_ENV: 'production' + }) .transform(unassertify) .plugin(commonShake) .plugin(flattenBundle) @@ -166,6 +170,9 @@ function bundle(dest, variant, entry, done) { timer.start('build dev'); browserify(browserifyOptions) + .transform(envify, { + NODE_ENV: 'development' + }) .plugin(collapse) .plugin(derequire) .add(src)