// @flow const path = require("path"); const fs = require("fs"); // Make sure any symlinks in the project folder are resolved: // https://github.com/facebookincubator/create-react-app/issues/637 const appDirectory = fs.realpathSync(process.cwd()); const resolveApp = (relativePath) => path.resolve(appDirectory, relativePath); const envPublicUrl = process.env.PUBLIC_URL; function ensureSlash(path /*: string */, needsSlash /*: bool */) { const hasSlash = path.endsWith("/"); if (hasSlash && !needsSlash) { return path.substr(0, path.length - 1); } else if (!hasSlash && needsSlash) { return `${path}/`; } else { return path; } } const getPublicUrl = () => envPublicUrl || "/"; // We use `PUBLIC_URL` environment variable field to infer "public path" at // which the app is served. Defaults to "/" // Webpack needs to know it to put the right