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

@ -197,7 +197,9 @@ export const setupIonicReact = (config: IonicConfig = {}) => {
* TODO: Remove when all integrations have been
* migrated to CE build.
*/
if (typeof (document as any) !== 'undefined') {
document.documentElement.classList.add('ion-ce');
}
initialize({
...config

View File

@ -21,8 +21,6 @@ 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
@ -30,7 +28,9 @@ export const IonicVue: Plugin = {
* 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({
@ -40,5 +40,4 @@ export const IonicVue: Plugin = {
_ce: ce
});
}
}
};