From 3c11a57931e1db483fbe5be731fe03c71dbcc344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20de=20=C3=81vila=20Martins?= Date: Fri, 16 Dec 2016 01:47:09 -0200 Subject: [PATCH 1/2] Add function parseHomepagePath with more logic It checks if the string starts with @ and if does, if removes the @ and goes along without parsing the url. --- packages/react-scripts/config/webpack.config.prod.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index 058db0d7921..fb0e626fa28 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -35,13 +35,20 @@ function ensureSlash(path, needsSlash) { } } +// If the user sets the homepage field on package.json as a url starting +// with @ it means they want to the publicPath themselves. +function parseHomepagePath(path) { + var useAbsolutePath = path.startsWith('@'); + return useAbsolutePath ? path.substr(1, path.length - 1) : url.parse(homepagePath).pathname +} + // We use "homepage" field to infer "public path" at which the app is served. // Webpack needs to know it to put the right