diff --git a/README.md b/README.md index 6009e8a6d88..69b6bbac8a7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,23 @@ # Create React App [![Build Status](https://travis-ci.org/facebookincubator/create-react-app.svg?branch=master)](https://travis-ci.org/facebookincubator/create-react-app) +## @ethersage/react-scripts +This is fork is maintained for the purpose of publishing `@ethersage/react-scripts` only. + +- Work shoud be merged to the `ethersage` branch +- Changes should not be made to any package other that `react-scripts`. +- New versions of `@facebookincubator/create-react-app` upstream will be merged into `ethersage` regularly. The first ethersage release off of a given upstream semver version will have the same version. Thereafter, changes to an upstream version will use a pre-release version of the upstream, such as `@ethersage/react-scripts@1.0.17-ethersage.1`. + +### Install warnings + +`yarn` on projects created with `@ethersage/react-scripts` produces a number of "normal" peer dependency warnings that are caused by upstream dependencies. The following are known as of the last update here, but will change as upstream dependencies change: + +``` +warning "@ethersage/react-scripts > react-hot-loader > redbox-react@1.4.2" has incorrect peer dependency "react@^0.14.0 || ^15.0.0". +warning "@ethersage/react-scripts > react-hot-loader > redbox-react@1.4.2" has incorrect peer dependency "react-dom@^0.14.0 || ^15.0.0". +``` + +## Continiuing Upstream README + Create React apps with no build configuration. * [Getting Started](#getting-started) – How to create a new app. diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index a6be022ba25..8fc6082f3f0 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/config/webpack.config.dev.js @@ -41,6 +41,9 @@ module.exports = { // This means they will be the "root" imports that are included in JS bundle. // The first two entry points enable "hot" CSS and auto-refreshes for JS. entry: [ + // HMR, + 'react-hot-loader/patch', + // We ship a few polyfills by default: require.resolve('./polyfills'), // Include an alternative client for WebpackDevServer. A client's job is to @@ -169,6 +172,7 @@ module.exports = { // @remove-on-eject-begin babelrc: false, presets: [require.resolve('babel-preset-react-app')], + plugins: ['react-hot-loader/babel'], // @remove-on-eject-end // This is a feature of `babel-loader` for webpack (not Babel itself). // It enables caching results in ./node_modules/.cache/babel-loader/ diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index dcac53cf49f..1c3231892a4 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -1,8 +1,8 @@ { - "name": "react-scripts", - "version": "1.0.17", + "name": "@ethersage/react-scripts", + "version": "1.0.17-ethersage.2", "description": "Configuration and scripts for Create React App.", - "repository": "facebookincubator/create-react-app", + "repository": "ethersage/create-react-app", "license": "MIT", "engines": { "node": ">=6" @@ -50,6 +50,7 @@ "promise": "8.0.1", "raf": "3.4.0", "react-dev-utils": "^4.2.1", + "react-hot-loader": "^3.0.0", "style-loader": "0.19.0", "sw-precache-webpack-plugin": "0.11.4", "url-loader": "0.6.2", diff --git a/packages/react-scripts/scripts/init.js b/packages/react-scripts/scripts/init.js index b283bad6ee6..0d28af5bd95 100644 --- a/packages/react-scripts/scripts/init.js +++ b/packages/react-scripts/scripts/init.js @@ -99,7 +99,7 @@ module.exports = function( command = 'npm'; args = ['install', '--save', verbose && '--verbose'].filter(e => e); } - args.push('react', 'react-dom'); + args.push('react', 'react-dom', 'react-hot-loader'); // Install additional template dependencies, if present const templateDependenciesPath = path.join( diff --git a/packages/react-scripts/template/src/index.js b/packages/react-scripts/template/src/index.js index fae3e3500cf..24a0ecb9f16 100644 --- a/packages/react-scripts/template/src/index.js +++ b/packages/react-scripts/template/src/index.js @@ -1,8 +1,27 @@ import React from 'react'; import ReactDOM from 'react-dom'; +import { AppContainer } from 'react-hot-loader'; import './index.css'; import App from './App'; import registerServiceWorker from './registerServiceWorker'; -ReactDOM.render(, document.getElementById('root')); +const rootEl = document.getElementById('root'); +ReactDOM.render( + + + , + rootEl +); registerServiceWorker(); + +if (module.hot) { + module.hot.accept('./App', () => { + const NextApp = require('./App').default; + ReactDOM.render( + + + , + rootEl + ); + }); +}