diff --git a/configs/paths.js b/configs/paths.js index 2e70c862eb..451713f582 100644 --- a/configs/paths.js +++ b/configs/paths.js @@ -1,10 +1,11 @@ -import path from 'path'; -import fs from 'fs'; -import url from 'url'; -import { findMonorepo } from 'react-dev-utils/workspaceUtils'; +'use strict'; + +const path = require('path'); +const fs = require('fs'); +const url = require('url'); // Make sure any symlinks in the project folder are resolved: -// https://github.com/facebook/create-react-app/issues/637 +// https://github.com/facebookincubator/create-react-app/issues/637 const appDirectory = fs.realpathSync(process.cwd()); const resolveApp = relativePath => path.resolve(appDirectory, relativePath); @@ -13,7 +14,7 @@ const envPublicUrl = process.env.PUBLIC_URL; function ensureSlash(path, needsSlash) { const hasSlash = path.endsWith('/'); if (hasSlash && !needsSlash) { - return path.substr(0, path.length - 1); + return path.substr(path, path.length - 1); } else if (!hasSlash && needsSlash) { return `${path}/`; } else { @@ -24,12 +25,6 @@ function ensureSlash(path, needsSlash) { const getPublicUrl = appPackageJson => envPublicUrl || require(appPackageJson).homepage; -// We use `PUBLIC_URL` environment variable or "homepage" field to infer -// "public path" at which the app is served. -// Webpack needs to know it to put the right