From f28e5436136add005de411a3690d85a6395c8def Mon Sep 17 00:00:00 2001 From: kami Date: Wed, 15 Nov 2017 17:08:35 -0700 Subject: [PATCH 1/4] react-hot-loader --- .../config/webpack.config.dev.js | 4 ++++ packages/react-scripts/package.json | 5 +++-- packages/react-scripts/scripts/init.js | 2 +- packages/react-scripts/template/src/index.js | 21 ++++++++++++++++++- 4 files changed, 28 insertions(+), 4 deletions(-) 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..caf280f200e 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -1,8 +1,8 @@ { - "name": "react-scripts", + "name": "@ethersage/react-scripts", "version": "1.0.17", "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 + ); + }); +} From a5c5dabc5863798648f28e3d4cee68beade29382 Mon Sep 17 00:00:00 2001 From: kami Date: Wed, 15 Nov 2017 21:37:46 -0700 Subject: [PATCH 2/4] react-scripts@1.0.17-ethersage.2 --- packages/react-scripts/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index caf280f200e..1c3231892a4 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -1,6 +1,6 @@ { "name": "@ethersage/react-scripts", - "version": "1.0.17", + "version": "1.0.17-ethersage.2", "description": "Configuration and scripts for Create React App.", "repository": "ethersage/create-react-app", "license": "MIT", From 595a580728703f78a6eba50d547e395b5a3ee44d Mon Sep 17 00:00:00 2001 From: Joshua Kaminetsky Date: Wed, 27 Dec 2017 14:11:39 -0700 Subject: [PATCH 3/4] README (#2) * maintained fork info --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 6009e8a6d88..20d95869c9a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,12 @@ # 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`. + Create React apps with no build configuration. * [Getting Started](#getting-started) – How to create a new app. From 654516e063e9628b6b6814eb660ec1433202073a Mon Sep 17 00:00:00 2001 From: kami Date: Wed, 27 Dec 2017 14:44:13 -0700 Subject: [PATCH 4/4] document common peer dependency warnings --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 20d95869c9a..69b6bbac8a7 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,17 @@ This is fork is maintained for the purpose of publishing `@ethersage/react-scrip - 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.