mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-04-24 05:05:53 +08:00
Fixes a silent crash when ejecting (#1810)
* Fixes a silent crash when ejecting * Delete unnecessary files * Remove references to eslintrc in Webpack config * Fix lint * Correct ESLint CLI options
This commit is contained in:
14
packages/react-scripts/scripts/eject.js
vendored
14
packages/react-scripts/scripts/eject.js
vendored
@@ -100,12 +100,6 @@ prompt(
|
||||
|
||||
const ownPackage = require(path.join(ownPath, 'package.json'));
|
||||
const appPackage = require(path.join(appPath, 'package.json'));
|
||||
const babelConfig = JSON.parse(
|
||||
fs.readFileSync(path.join(ownPath, '.babelrc'), 'utf8')
|
||||
);
|
||||
const eslintConfig = JSON.parse(
|
||||
fs.readFileSync(path.join(ownPath, '.eslintrc'), 'utf8')
|
||||
);
|
||||
|
||||
console.log(cyan('Updating the dependencies'));
|
||||
const ownPackageName = ownPackage.name;
|
||||
@@ -154,11 +148,15 @@ prompt(
|
||||
|
||||
// Add Babel config
|
||||
console.log(` Adding ${cyan('Babel')} preset`);
|
||||
appPackage.babel = babelConfig;
|
||||
appPackage.babel = {
|
||||
presets: ['react-app'],
|
||||
};
|
||||
|
||||
// Add ESlint config
|
||||
console.log(` Adding ${cyan('ESLint')} configuration`);
|
||||
appPackage.eslintConfig = eslintConfig;
|
||||
appPackage.eslintConfig = {
|
||||
extends: 'react-app',
|
||||
};
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(appPath, 'package.json'),
|
||||
|
||||
Reference in New Issue
Block a user