Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function rewirePaths() {
require('react-scripts/config/env');
const paths = require('react-scripts/config/paths');
if (!fs.existsSync(paths.appIndexJs)) {
paths.appIndexJs = path.resolve(paths.appPath, 'src/index.ts');
}
if (!fs.existsSync(paths.appPublic)) {
paths.appPublic = path.resolve(__dirname, '../config/webpack/public');
paths.appHtml = path.resolve(paths.appPublic, 'index.html');
}
require.cache[require.resolve('react-scripts/config/paths')].exports = paths;
}
function rewirePaths() {
require('react-scripts/config/env');
const paths = require('react-scripts/config/paths');
if (!fs.existsSync(paths.appIndexJs)) {
paths.appIndexJs = path.resolve(paths.appPath, 'src/index.ts');
}
if (!fs.existsSync(paths.appPublic)) {
paths.appPublic = path.resolve(__dirname, '../config/webpack/public');
paths.appHtml = path.resolve(paths.appPublic, 'index.html');
}
require.cache[require.resolve('react-scripts/config/paths')].exports = paths;
}
function copyPublicFolder() {
fs.copySync(paths.appPublic, paths.appBuild, {
dereference: true,
filter: file => file !== paths.appHtml
});
}
function copyPublicFolder() {
fs.copySync(paths.appPublic, paths.appBuild, {
dereference: true,
filter: file => file !== paths.appHtml
});
}
function ensureSlash(inputPath, needsSlash) {
const hasSlash = inputPath.endsWith('/')
if(hasSlash && !needsSlash) return inputPath.substr(0, inputPath.length - 1)
else if(!hasSlash && needsSlash) return `${inputPath}/`
else return inputPath
}
function getServedPath(publicUrl) {
const servedUrl = publicUrl ? url.parse(publicUrl).pathname : '/'
return ensureSlash(servedUrl, true)
}
paths.dotenv = existsSync(appDotEnv) ? appDotEnv : paths.dotenv
paths.appPath = appRootPath + '/'
paths.appPublic = appPublic
paths.appHtml = appPublic + '/index.html'
paths.appBuild = appBuild
paths.appPackageJson = appPackage
paths.yarnLockFile = appRootPath + '/yarn.lock'
paths.appSrc = appSrc
paths.appIndexJs = appSrc + '/index.js'
paths.proxySetup = appSrc + '/setupProxy.js'
paths.testsSetup = appSrc + '/setupTests'
paths.appNodeModules = appNodeModules
paths.servedPath = homepage ? getServedPath(homepage) : '/'
paths.publicUrl = homepage || ''
module.exports = paths
function rewirePaths() {
require('react-scripts/config/env');
const paths = require('react-scripts/config/paths');
if (!fs.existsSync(paths.appIndexJs)) {
paths.appIndexJs = path.resolve(paths.appPath, 'src/index.ts');
}
if (!fs.existsSync(paths.appPublic)) {
paths.appPublic = path.resolve(__dirname, '../config/webpack/public');
paths.appHtml = path.resolve(paths.appPublic, 'index.html');
}
require.cache[require.resolve('react-scripts/config/paths')].exports = paths;
}
function rewirePaths() {
require('react-scripts/config/env');
const paths = require('react-scripts/config/paths');
if (!fs.existsSync(paths.appIndexJs)) {
paths.appIndexJs = path.resolve(paths.appPath, 'src/index.ts');
}
if (!fs.existsSync(paths.appPublic)) {
paths.appPublic = path.resolve(__dirname, '../config/webpack/public');
paths.appHtml = path.resolve(paths.appPublic, 'index.html');
}
require.cache[require.resolve('react-scripts/config/paths')].exports = paths;
}