aboutsummaryrefslogtreecommitdiffstats
path: root/gulpfile.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-04-04 00:51:33 +0800
committerkumavis <aaron@kumavis.me>2018-04-04 00:51:33 +0800
commit00657e14a8b102051157e18bbea24630ff050488 (patch)
treeac3cc49f188cfb256480adfd4f9022270b4b964c /gulpfile.js
parent69778416cab4900d2c6ef5876ecddc92aa63642b (diff)
downloadtangerine-wallet-browser-00657e14a8b102051157e18bbea24630ff050488.tar
tangerine-wallet-browser-00657e14a8b102051157e18bbea24630ff050488.tar.gz
tangerine-wallet-browser-00657e14a8b102051157e18bbea24630ff050488.tar.bz2
tangerine-wallet-browser-00657e14a8b102051157e18bbea24630ff050488.tar.lz
tangerine-wallet-browser-00657e14a8b102051157e18bbea24630ff050488.tar.xz
tangerine-wallet-browser-00657e14a8b102051157e18bbea24630ff050488.tar.zst
tangerine-wallet-browser-00657e14a8b102051157e18bbea24630ff050488.zip
build - correctly set METAMASK_ENV via envify
Diffstat (limited to 'gulpfile.js')
-rw-r--r--gulpfile.js16
1 files changed, 7 insertions, 9 deletions
diff --git a/gulpfile.js b/gulpfile.js
index b71ce0703..4f0da9d60 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -1,5 +1,6 @@
const watchify = require('watchify')
const browserify = require('browserify')
+const envify = require('envify/custom')
const disc = require('disc')
const gulp = require('gulp')
const source = require('vinyl-source-stream')
@@ -377,12 +378,6 @@ gulp.task('zip:edge', zipTask('edge'))
gulp.task('zip:opera', zipTask('opera'))
gulp.task('zip', gulp.parallel('zip:chrome', 'zip:firefox', 'zip:edge', 'zip:opera'))
-// set env for production
-gulp.task('apply-prod-environment', function(done) {
- process.env.NODE_ENV = 'production'
- done()
-});
-
// high level tasks
gulp.task('dev',
@@ -458,7 +453,6 @@ gulp.task('build:mascara',
gulp.task('dist',
gulp.series(
- 'apply-prod-environment',
'build',
'zip'
)
@@ -484,6 +478,12 @@ function generateBundler(opts, performBundle) {
let bundler = browserify(browserifyOpts)
+ // inject variables into bundle
+ bundler.transform(envify({
+ METAMASK_DEBUG: opts.devMode,
+ NODE_ENV: opts.devMode ? 'development' : 'production',
+ }))
+
// Minification
if (opts.minifyBuild) {
bundler.transform('uglifyify', {
@@ -557,8 +557,6 @@ function bundleTask(opts) {
buildStream = buildStream
// convert bundle stream to gulp vinyl stream
.pipe(source(opts.filename))
- // inject variables into bundle
- .pipe(replace('\'GULP_METAMASK_DEBUG\'', opts.devMode))
// buffer file contents (?)
.pipe(buffer())