From ea16fbfb9062aea3b7e4591801425ebce31bdf19 Mon Sep 17 00:00:00 2001 From: CD Cabrera Date: Wed, 7 Dec 2022 20:10:22 -0500 Subject: [PATCH] DEV remove browserrouter --- config/build.plugins.js | 5 ++++- src/AppEntry.js | 6 +----- src/index.appEntry.js | 18 ++++++++++++++++++ src/index.bootstrap.js | 7 +++++++ src/index.js | 2 +- 5 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 src/index.appEntry.js create mode 100644 src/index.bootstrap.js diff --git a/config/build.plugins.js b/config/build.plugins.js index c19413022..263eff5a6 100644 --- a/config/build.plugins.js +++ b/config/build.plugins.js @@ -33,7 +33,10 @@ const setCommonPlugins = () => { }), fedModulePlugin({ root: RELATIVE_DIRNAME, - shared: [{ 'react-redux': { requiredVersion: dependencies['react-redux'] } }] + shared: [ + { 'react-router-dom': { singleton: true, requiredVersion: '*' } }, + { 'react-redux': { requiredVersion: dependencies['react-redux'] } } + ] }) ]; diff --git a/src/AppEntry.js b/src/AppEntry.js index 5263c7141..35bde9b19 100644 --- a/src/AppEntry.js +++ b/src/AppEntry.js @@ -1,7 +1,5 @@ import React from 'react'; import { Provider } from 'react-redux'; -import { BrowserRouter } from 'react-router-dom'; -import { routerHelpers } from './components/router'; import { store } from './redux'; import App from './app'; import './styles/index.scss'; @@ -9,9 +7,7 @@ import '@patternfly/react-styles/css/components/Select/select.css'; const AppEntry = () => ( - - - + ); diff --git a/src/index.appEntry.js b/src/index.appEntry.js new file mode 100644 index 000000000..5263c7141 --- /dev/null +++ b/src/index.appEntry.js @@ -0,0 +1,18 @@ +import React from 'react'; +import { Provider } from 'react-redux'; +import { BrowserRouter } from 'react-router-dom'; +import { routerHelpers } from './components/router'; +import { store } from './redux'; +import App from './app'; +import './styles/index.scss'; +import '@patternfly/react-styles/css/components/Select/select.css'; + +const AppEntry = () => ( + + + + + +); + +export { AppEntry as default, AppEntry }; diff --git a/src/index.bootstrap.js b/src/index.bootstrap.js new file mode 100644 index 000000000..cce9e0f7e --- /dev/null +++ b/src/index.bootstrap.js @@ -0,0 +1,7 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import { AppEntry } from './index.appEntry'; + +const root = document.getElementById('root'); + +ReactDOM.render(, root, () => root.setAttribute('data-ouia-safe', true)); diff --git a/src/index.js b/src/index.js index 7f0975627..3d7183030 100644 --- a/src/index.js +++ b/src/index.js @@ -3,7 +3,7 @@ */ import './styles/standalone.scss'; import '@patternfly/react-core/dist/styles/base.css'; -import('./bootstrap'); +import('./index.bootstrap'); import { routerHelpers } from './components/router'; window.insights = {