File tree Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Original file line number Diff line number Diff line change 22
33Use ` single-spa ` ` systemjs ` in your ` create-react-app ` .
44
5- > It is recommended to use the development mode to ensure stability !!!
5+ > Quickly adapt cra as a submodule of single-spa !!!
66
77## Installation
88
@@ -22,15 +22,20 @@ const { rewiredSingleSpaDevServer } = require("react-app-rewired-single-spa");
2222
2323module .exports = {
2424 webpack: rewiredSingleSpa (),
25- devServer: rewiredSingleSpaDevServer,
25+ devServer : function (configFunction ) {
26+ return function (proxy , allowedHost ) {
27+ const config = configFunction (proxy, allowedHost);
28+ return rewiredSingleSpaDevServer ()(config);
29+ };
30+ },
2631};
2732
2833// use `customize-cra`
29- const { override } = require (" customize-cra" );
34+ const { override , overrideDevServer } = require (" customize-cra" );
3035
3136module .exports = {
3237 webpack: override (rewiredSingleSpa ()),
33- devServer: rewiredSingleSpaDevServer,
38+ devServer: overrideDevServer ( rewiredSingleSpaDevServer ()) ,
3439};
3540```
3641
Original file line number Diff line number Diff line change @@ -49,9 +49,8 @@ function rewiredSingleSpa({
4949 ] ,
5050 } ) ;
5151
52- return function ( config , webpackEnv ) {
53- const isEnvProduction =
54- ( webpackEnv || process . env . BABEL_ENV ) === "production" ;
52+ return function ( config , webpackEnv = process . env . BABEL_ENV ) {
53+ const isEnvProduction = webpackEnv === "production" ;
5554
5655 // amend input output
5756 config . output = {
@@ -155,12 +154,10 @@ function rewiredSingleSpa({
155154 } ;
156155}
157156
158- function rewiredSingleSpaDevServer ( configFunction ) {
157+ function rewiredSingleSpaDevServer ( ) {
159158 const webpackMajorVersion = getWebpackMajorVersion ( ) ;
160159
161- return function ( proxy , allowedHost ) {
162- const config = configFunction ( proxy , allowedHost ) ;
163-
160+ return function ( config ) {
164161 config . historyApiFallback = true ;
165162 if ( webpackMajorVersion < 5 ) {
166163 config . headers = {
You can’t perform that action at this time.
0 commit comments