File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33// Do this as the first thing so that any code reading it knows the right env.
44process . env . NODE_ENV = 'production' ;
55
6+ // Use dynamic server data in production by inserting a token that will be
7+ // replaced when the HTML page is served.
68process . env . REACT_APP_SERVER_DATA = '__SERVER_DATA__' ;
79
810// Load environment variables from .env file. Suppress warnings using silent
Original file line number Diff line number Diff line change 22
33process . env . NODE_ENV = 'development' ;
44
5+ // Use static server data in development.
56process . env . REACT_APP_SERVER_DATA = JSON . stringify ( require ( '../server/dev-data' ) )
67
78// Load environment variables from .env file. Suppress warnings using silent
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ const sendHomePage = (publicDir) => {
1919 } else {
2020 res . set ( 'Cache-Control' , 'public, max-age=60' )
2121 res . send (
22+ // Replace the __SERVER_DATA__ token that was added to the
23+ // HTML file in the build process (see scripts/build.js).
2224 html . replace ( '__SERVER_DATA__' , JSON . stringify ( {
2325 cloudflareStats : stats
2426 } ) )
You can’t perform that action at this time.
0 commit comments