Interactive interface for browsing global, full-resolution satellite imagery
break up bundle transform to function conditionally depending on dev or prod
Ed Platoc86f09425c64
diff --git a/tasks/buildJS.js b/tasks/buildJS.jsindex 7542065e9..937fa0403 100644--- a/tasks/buildJS.js+++ b/tasks/buildJS.js@@ -26,23 +26,34 @@ if (!fs.existsSync(outputDir)) {}}+// bundler is broken up conditionally to allow watch for dev, and uglification for prodvar bundler = browserify(entryPoint, {debug: !isProduction, // Include source maps (makes bundle size larger)fullPaths: !isProduction, // For use with https://www.npmjs.com/package/disccache: {}, // Required for watchifypackageCache: {}, // Required for watchifyplugin: [isWatching ? watchify : null]-}).transform('envify', { // Replace env variables with strings - allows deadcode removal with uglifyify (below) and unglifyjs (see npm script "build:js")- NODE_ENV: process.env.NODE_ENV,- global: true-}).transform('babelify', {+});++if (isProduction) {+ bundler = bundler.transform('envify', { // Replace env variables with strings - allows deadcode removal with uglifyify (below) and unglifyjs (see npm script "build:js")+ NODE_ENV: process.env.NODE_ENV,+ global: true+ });+}++bundler = bundler.transform('babelify', { // necessary regardless of dev or prod buildpresets: ['env']}).transform('browserify-shim', {global: true-}).transform('uglifyify', { // With sourcemaps turned on, it's ok to uglify in dev- global: true});+if (isProduction) {+ bundler = bundler.transform('uglifyify', { // With sourcemaps turned on, it's ok to uglify in dev+ global: true+ });+}+function bundle() {const begin = Date.now();var stream = fs.createWriteStream(outputPath);