Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes a silent crash when ejecting #1810

Merged
merged 5 commits into from
Mar 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions packages/react-scripts/babelrc

This file was deleted.

9 changes: 3 additions & 6 deletions packages/react-scripts/config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeM
const getClientEnvironment = require('./env');
const paths = require('./paths');

// @remove-on-eject-begin
// `path` is not used after eject - see https://github.com/facebookincubator/create-react-app/issues/1174
const path = require('path');
// @remove-on-eject-end

// Webpack uses `publicPath` to determine where the app is being served from.
// In development, we always serve from the root. This makes config easier.
const publicPath = '/';
Expand Down Expand Up @@ -121,7 +116,9 @@ module.exports = {
// @remove-on-eject-begin
// Point ESLint to our predefined config.
options: {
configFile: path.join(__dirname, '../eslintrc'),
baseConfig: {
extends: ['react-app'],
},
useEslintrc: false,
},
// @remove-on-eject-end
Expand Down
9 changes: 3 additions & 6 deletions packages/react-scripts/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
const paths = require('./paths');
const getClientEnvironment = require('./env');

// @remove-on-eject-begin
// `path` is not used after eject - see https://github.com/facebookincubator/create-react-app/issues/1174
const path = require('path');
// @remove-on-eject-end

// Webpack uses `publicPath` to determine where the app is being served from.
// It requires a trailing slash, or the file assets will get an incorrect path.
const publicPath = paths.servedPath;
Expand Down Expand Up @@ -122,7 +117,9 @@ module.exports = {
options: {
// TODO: consider separate config for production,
// e.g. to enable no-console and no-debugger only in production.
configFile: path.join(__dirname, '../eslintrc'),
baseConfig: {
extends: ['react-app'],
},
useEslintrc: false,
},
// @remove-on-eject-end
Expand Down
3 changes: 0 additions & 3 deletions packages/react-scripts/eslintrc

This file was deleted.

2 changes: 0 additions & 2 deletions packages/react-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
"url": "https://github.com/facebookincubator/create-react-app/issues"
},
"files": [
"babelrc",
"eslintrc",
"bin",
"config",
"scripts",
Expand Down
14 changes: 6 additions & 8 deletions packages/react-scripts/scripts/eject.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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'),
Expand Down