From 20d8f0f5db78964dc01202bd02ad97310edd531b Mon Sep 17 00:00:00 2001 From: Erik Ziegler Date: Thu, 15 Aug 2019 09:12:48 +0200 Subject: [PATCH] chore: Add hot-reloading for the React app --- babel.config.js | 1 + package.json | 1 + platform/viewer/src/App.js | 5 ++++- yarn.lock | 14 ++++++++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/babel.config.js b/babel.config.js index 041795dea..204019d22 100644 --- a/babel.config.js +++ b/babel.config.js @@ -22,6 +22,7 @@ module.exports = { // https://babeljs.io/docs/en/options#babelrcroots babelrcRoots: ['./platform/*', './extensions/*'], plugins: [ + 'react-hot-loader/babel', 'inline-react-svg', '@babel/plugin-proposal-class-properties', '@babel/plugin-proposal-object-rest-spread', diff --git a/package.json b/package.json index 4ba088fbb..de1b2446a 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,7 @@ "prettier": "^1.18.2", "react": "^16.8.6", "react-dom": "^16.8.6", + "react-hot-loader": "^4.12.11", "react-scripts": "^3.0.1", "redux-testkit": "^1.0.6", "shader-loader": "^1.3.1", diff --git a/platform/viewer/src/App.js b/platform/viewer/src/App.js index cafd29afa..9eac5d408 100644 --- a/platform/viewer/src/App.js +++ b/platform/viewer/src/App.js @@ -1,4 +1,7 @@ +import { hot } from 'react-hot-loader/root'; + import './config'; + // Polyfills // PWA Only? import 'core-js/features/array/flat'; @@ -194,5 +197,5 @@ function _makeAbsoluteIfNecessary(url, base_url) { return base_url + url; } -export default App; +export default hot(App); export { commandsManager, extensionManager, hotkeysManager }; diff --git a/yarn.lock b/yarn.lock index fa7e84211..b3e3b832c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15184,6 +15184,20 @@ react-hot-loader@4.3.6: react-lifecycles-compat "^3.0.4" shallowequal "^1.0.2" +react-hot-loader@^4.12.11: + version "4.12.11" + resolved "https://registry.yarnpkg.com/react-hot-loader/-/react-hot-loader-4.12.11.tgz#06bd618d0a7343c8afa4a31206844f651193bae5" + integrity sha512-ySsg1hPwr/5dkZCJVp1nZRbwbpbEQ+3e2+bn/D681Wvr9+o+5bLKkTGq0TXskj8HgCS3ScysXddOng9Cg+JKzw== + dependencies: + fast-levenshtein "^2.0.6" + global "^4.3.0" + hoist-non-react-statics "^3.3.0" + loader-utils "^1.1.0" + prop-types "^15.6.1" + react-lifecycles-compat "^3.0.4" + shallowequal "^1.1.0" + source-map "^0.7.3" + react-hot-loader@^4.8.4: version "4.12.10" resolved "https://registry.yarnpkg.com/react-hot-loader/-/react-hot-loader-4.12.10.tgz#b3457c0f733423c4827c6d2672e50c9f8bedaf6b"