refactor: AppContext and App entrypoints

This commit is contained in:
Sérgio Salgado 2021-03-03 17:05:26 +00:00 committed by Josh Harvey
parent 442e7cd8d9
commit dd0abc8a8b
7 changed files with 32 additions and 10 deletions

View file

@ -1,10 +1,28 @@
import React from 'react'
import ReactDOM from 'react-dom'
import App from './App'
import * as serviceWorker from './serviceWorker'
ReactDOM.render(<App />, document.getElementById('root'))
function importBuildTarget() {
if (process.env.REACT_APP_BUILD_TARGET === 'LAMASSU') {
return import('./App')
} else if (process.env.REACT_APP_BUILD_TARGET === 'PAZUZ') {
return import('./pazuz/App')
} else {
return Promise.reject(
new Error('No such build target: ' + process.env.REACT_APP_BUILD_TARGET)
)
}
}
importBuildTarget().then(({ default: Environment }) =>
ReactDOM.render(
<React.StrictMode>
<Environment />
</React.StrictMode>,
document.getElementById('root')
)
)
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.