Fix error with new CRA Webpack config

This commit is contained in:
Brody McKee 2018-12-21 15:57:11 +02:00
parent b411a2bfb5
commit 2a7c42b3d0

View File

@ -68,12 +68,12 @@ export function getCraWebpackConfig(mode) {
const pathToReactScripts = getReactScriptsPath();
const craWebpackConfig =
mode === 'production' ? 'config/webpack.config.prod' : 'config/webpack.config.dev';
mode === 'production' ? 'config/webpack.config.prod.js' : 'config/webpack.config.dev.js';
let pathToWebpackConfig = require.resolve(path.join(pathToReactScripts, craWebpackConfig));
let pathToWebpackConfig = path.join(pathToReactScripts, craWebpackConfig);
if (!fs.existsSync(pathToWebpackConfig)) {
pathToWebpackConfig = path.join(pathToReactScripts, 'config/webpack.config');
pathToWebpackConfig = path.join(pathToReactScripts, 'config/webpack.config.js');
}
// eslint-disable-next-line import/no-dynamic-require,global-require