From 83028e598133ffb208237bda4c35c0797a27f1e0 Mon Sep 17 00:00:00 2001 From: Jim Cummins Date: Wed, 18 Dec 2019 22:44:39 -0600 Subject: [PATCH] fix: add template support for homepage, browserslist properties This change updates the init script to allow for the homepage property to be set by a template. The homepage field with a value of "." is used when running applications at non-root of a domain. Additionally this adds support for templates to customize the browserlist property. This is useful specifically when a template includes IE support out of the box. --- packages/react-scripts/scripts/init.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/react-scripts/scripts/init.js b/packages/react-scripts/scripts/init.js index 74d607b105d..15951c5d633 100644 --- a/packages/react-scripts/scripts/init.js +++ b/packages/react-scripts/scripts/init.js @@ -150,7 +150,14 @@ module.exports = function( }; // Setup the browsers list - appPackage.browserslist = defaultBrowsers; + const templateBrowsers = templateJson.browserslist || defaultBrowsers; + appPackage.browserslist = templateBrowsers; + + // Setup the homepage if defined + const templateHomepage = templateJson.homepage; + if(typeof templateHomepage !== "undefined") { + appPackage.homepage = templateHomepage + } fs.writeFileSync( path.join(appPath, 'package.json'),