diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index 058db0d7921..f5f8b67533e 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 set 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