File tree Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Original file line number Diff line number Diff line change 1- const { mapValues, keyBy } = require ( 'lodash' ) ;
2-
31module . exports = {
42 // Enable or disable server-side rendering
53 enableSSR : true ,
@@ -12,13 +10,10 @@ module.exports = {
1210 // in node.js.
1311 //
1412 // **WARNING**: Be careful not to expose any secrets here!
15- clientEnv : mapValues (
16- keyBy ( [
17- 'NODE_ENV' ,
18- 'APPLICATION_BASE_URL'
19- ] ) ,
20- ( env ) => JSON . stringify ( process . env [ env ] )
21- ) ,
13+ clientEnvVars : [
14+ 'NODE_ENV' ,
15+ 'APPLICATION_BASE_URL'
16+ ] ,
2217
2318 /* The identifier to use for css-modules.
2419 */
Original file line number Diff line number Diff line change @@ -4,11 +4,11 @@ if (isDev) require('dotenv').load();
44import yn from 'yn' ;
55import path from 'path' ;
66import webpack from 'webpack' ;
7- import mapValues from 'lodash/mapValues' ;
87import IsoPlugin from 'webpack-isomorphic-tools/plugin' ;
98import ExtractTextPlugin from 'extract-text-webpack-plugin' ;
109import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer' ;
1110import { ReactLoadablePlugin } from 'react-loadable/webpack' ;
11+ import { mapValues , keyBy } from 'lodash' ;
1212import config from '../config' ;
1313
1414let ssr = yn ( process . env . SSR ) || false ;
@@ -24,7 +24,9 @@ let plugins = [
2424 extractTextPlugin ,
2525 new webpack . ContextReplacementPlugin ( / m o m e n t [ / \\ ] l o c a l e $ / , / e n | e s / ) ,
2626 new webpack . DefinePlugin ( {
27- 'process.env' : config . clientEnv
27+ 'process.env' : mapValues ( keyBy ( config . clientEnvVars ) , ( env ) => {
28+ return JSON . stringify ( process . env [ env ] ) ;
29+ } )
2830 } )
2931] ;
3032
You can’t perform that action at this time.
0 commit comments