fix(react): setupIonicReact no longer crashes in SSR environment (#24604)

This commit is contained in:
Liam DeBeasi
2022-01-19 15:48:46 -05:00
committed by GitHub
parent 35e5235645
commit 360643d96a
2 changed files with 19 additions and 18 deletions

View File

@ -21,24 +21,23 @@ const getHelperFunctions = () => {
export const IonicVue: Plugin = {
async install(_: App, config: IonicConfig = {}) {
if (typeof (window as any) !== 'undefined') {
/**
* By default Ionic Framework hides elements that
* are not hydrated, but in the CE build there is no
* hydration.
* TODO: Remove when all integrations have been
* migrated to CE build.
*/
/**
* By default Ionic Framework hides elements that
* are not hydrated, but in the CE build there is no
* hydration.
* TODO: Remove when all integrations have been
* migrated to CE build.
*/
if (typeof (document as any) !== 'undefined') {
document.documentElement.classList.add('ion-ce');
const { ael, rel, ce } = getHelperFunctions();
initialize({
...config,
_ael: ael,
_rel: rel,
_ce: ce
});
}
const { ael, rel, ce } = getHelperFunctions();
initialize({
...config,
_ael: ael,
_rel: rel,
_ce: ce
});
}
};