From 699b849914115b19471c3d012fc5db1b80072471 Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Tue, 30 Jul 2019 15:30:47 -0700 Subject: [PATCH] Keep NODE_ENV in app.yaml --- app-staging.yaml | 2 ++ app.yaml | 2 ++ rollup.config.js | 10 +++++----- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app-staging.yaml b/app-staging.yaml index 7fdf95c..4374bb0 100644 --- a/app-staging.yaml +++ b/app-staging.yaml @@ -3,3 +3,5 @@ env: standard instance_class: B4 basic_scaling: max_instances: 1 +env_variables: + NODE_ENV: 'staging' diff --git a/app.yaml b/app.yaml index 529364b..43d79f5 100644 --- a/app.yaml +++ b/app.yaml @@ -4,3 +4,5 @@ instance_class: F4 automatic_scaling: min_idle_instances: 2 max_instances: 12 +env_variables: + NODE_ENV: 'production' diff --git a/rollup.config.js b/rollup.config.js index 6e0c124..79991cf 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -13,8 +13,7 @@ const url = require('rollup-plugin-url'); const entryManifest = require('./plugins/entryManifest'); const pkg = require('./package.json'); -const env = process.env.NODE_ENV || 'development'; -const dev = env === 'development'; +const env = process.env.BUILD_ENV || 'development'; const manifest = entryManifest(); @@ -55,12 +54,14 @@ const client = ['browse', 'main'].map(entryName => { limit: 5 * 1024, publicPath: '/_client/' }), - compiler(dev ? { formatting: 'PRETTY_PRINT' } : undefined) + compiler( + env !== 'production' ? { formatting: 'PRETTY_PRINT' } : undefined + ) ] }; }); -const dependencies = (dev +const dependencies = (env === 'development' ? Object.keys(pkg.dependencies).concat(Object.keys(pkg.devDependencies || {})) : Object.keys(pkg.dependencies) ).concat('react-dom/server'); @@ -86,7 +87,6 @@ const server = { ), 'process.env.CLOUDFLARE_KEY': JSON.stringify(process.env.CLOUDFLARE_KEY), 'process.env.DEBUG': JSON.stringify(process.env.DEBUG), - 'process.env.NODE_ENV': JSON.stringify(env), 'process.env.NPM_REGISTRY_URL': JSON.stringify( process.env.NPM_REGISTRY_URL ),