packages/cli,dev-utils: add react hot loading support

This commit is contained in:
Patrik Oldsberg
2020-05-16 16:07:18 +02:00
parent 3643faf3d4
commit 90aee3b1aa
5 changed files with 39 additions and 12 deletions
+1
View File
@@ -41,6 +41,7 @@
"@types/node": "^12.0.0",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-hot-loader": "^4.12.21",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0"
},
+3 -2
View File
@@ -14,6 +14,7 @@
* limitations under the License.
*/
import { hot } from 'react-hot-loader/root';
import React, { FC, ComponentType } from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter } from 'react-router-dom';
@@ -90,10 +91,10 @@ class DevAppBuilder {
}
/**
* Build and render directory to #root element
* Build and render directory to #root element, with react hot loading.
*/
render(): void {
const DevApp = this.build();
const DevApp = hot(this.build());
const paths = this.findPluginPaths(this.plugins);