Skip to content

Commit ccb5f84

Browse files
gaearonTimer
authored andcommitted
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
1 parent b55a7d8 commit ccb5f84

File tree

6 files changed

+12
-28
lines changed

6 files changed

+12
-28
lines changed

packages/react-scripts/babelrc

-3
This file was deleted.

packages/react-scripts/config/webpack.config.dev.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeM
1919
const getClientEnvironment = require('./env');
2020
const paths = require('./paths');
2121

22-
// @remove-on-eject-begin
23-
// `path` is not used after eject - see https://github.com/facebookincubator/create-react-app/issues/1174
24-
const path = require('path');
25-
// @remove-on-eject-end
26-
2722
// Webpack uses `publicPath` to determine where the app is being served from.
2823
// In development, we always serve from the root. This makes config easier.
2924
const publicPath = '/';
@@ -121,7 +116,9 @@ module.exports = {
121116
// @remove-on-eject-begin
122117
// Point ESLint to our predefined config.
123118
options: {
124-
configFile: path.join(__dirname, '../eslintrc'),
119+
baseConfig: {
120+
extends: ['react-app'],
121+
},
125122
useEslintrc: false,
126123
},
127124
// @remove-on-eject-end

packages/react-scripts/config/webpack.config.prod.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
1919
const paths = require('./paths');
2020
const getClientEnvironment = require('./env');
2121

22-
// @remove-on-eject-begin
23-
// `path` is not used after eject - see https://github.com/facebookincubator/create-react-app/issues/1174
24-
const path = require('path');
25-
// @remove-on-eject-end
26-
2722
// Webpack uses `publicPath` to determine where the app is being served from.
2823
// It requires a trailing slash, or the file assets will get an incorrect path.
2924
const publicPath = paths.servedPath;
@@ -122,7 +117,9 @@ module.exports = {
122117
options: {
123118
// TODO: consider separate config for production,
124119
// e.g. to enable no-console and no-debugger only in production.
125-
configFile: path.join(__dirname, '../eslintrc'),
120+
baseConfig: {
121+
extends: ['react-app'],
122+
},
126123
useEslintrc: false,
127124
},
128125
// @remove-on-eject-end

packages/react-scripts/eslintrc

-3
This file was deleted.

packages/react-scripts/package.json

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
"url": "https://github.com/facebookincubator/create-react-app/issues"
1212
},
1313
"files": [
14-
"babelrc",
15-
"eslintrc",
1614
"bin",
1715
"config",
1816
"scripts",

packages/react-scripts/scripts/eject.js

+6-8
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,6 @@ prompt(
100100

101101
const ownPackage = require(path.join(ownPath, 'package.json'));
102102
const appPackage = require(path.join(appPath, 'package.json'));
103-
const babelConfig = JSON.parse(
104-
fs.readFileSync(path.join(ownPath, '.babelrc'), 'utf8')
105-
);
106-
const eslintConfig = JSON.parse(
107-
fs.readFileSync(path.join(ownPath, '.eslintrc'), 'utf8')
108-
);
109103

110104
console.log(cyan('Updating the dependencies'));
111105
const ownPackageName = ownPackage.name;
@@ -154,11 +148,15 @@ prompt(
154148

155149
// Add Babel config
156150
console.log(` Adding ${cyan('Babel')} preset`);
157-
appPackage.babel = babelConfig;
151+
appPackage.babel = {
152+
presets: ['react-app'],
153+
};
158154

159155
// Add ESlint config
160156
console.log(` Adding ${cyan('ESLint')} configuration`);
161-
appPackage.eslintConfig = eslintConfig;
157+
appPackage.eslintConfig = {
158+
extends: 'react-app',
159+
};
162160

163161
fs.writeFileSync(
164162
path.join(appPath, 'package.json'),

0 commit comments

Comments
 (0)