Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ssr-handlers): fix globalThis is not defined #1175

Closed
wants to merge 2 commits into from

Conversation

okxiaoliang4
Copy link
Member

@okxiaoliang4 okxiaoliang4 commented Jan 24, 2022

fix globalThis is not defined

link issues
#1133 #1163 #1187

@okxiaoliang4 okxiaoliang4 changed the title fix(ssr-handlers): fix globalThis fix(ssr-handlers): fix globalThis is not defined Jan 24, 2022
@@ -21,12 +22,11 @@ export interface SSRHandlersMap {
updateHTMLAttrs: (selector: string, attribute: string, value: string) => void
}

const _global = globalThis || this
const globalKey = '__vueuse_ssr_handlers__'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not a fan of extra deps, use

const _global = typeof globalThis === 'undefined' ? this : globalThis

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but the build output this will transform to undefined

@antfu antfu closed this in 3c8cdde Jan 25, 2022
@okxiaoliang4 okxiaoliang4 deleted the fix/ssr-handlers branch January 26, 2022 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants