This repository has been archived by the owner on Sep 24, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What I did
This PR aims to change the way the React app is initialized so it can be loaded as micro front-end calling an init method available from the global window.
To do so I've applied the following changes:
app-elements
.20.11.0
(with other toolings that relies onpackage.json
's engines we have a more relaxed>=18
).rollup-plugin-external-global
package to havereact
andreact-dom
as externals.vite.config
to generatemanifest.json
.index.html
to load React from a CDN and initialize the app viawindow.clApp_${appName}.init
with initial settings retrieved from env vars..env
file is now versioned and distributed with default values (or empty, but they must exist). This is to allows vite to replace real content in the index.html (see point above).main.tsx
to usecreateApp
method from app-elements,App.tsx
tomain.tsx
to avoid unnecessary props drilling (except forrouterBase
).global.d.ts
since is now part of app-elements.HomePageLayout
from app-elements.How to test
Checklist