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

Broken SSR support since >2.0.1 #1

Closed
mikerogerz opened this issue Apr 18, 2019 · 6 comments
Closed

Broken SSR support since >2.0.1 #1

mikerogerz opened this issue Apr 18, 2019 · 6 comments

Comments

@mikerogerz
Copy link

var HEAD = document.head || document.getElementsByTagName('head')[0];
^ ReferenceError: document is not defined at /node_modules/vue-programmatic-invisible-google-recaptcha/dist/vue-programmatic-invisible-google-recaptcha.umd.js:204:16
@johndatserakis
Copy link
Owner

Hey there - sorry you're having trouble with this.

Honestly I don't use SSR for my projects so I was never sure of SSR support for this component. I made a few changes around 2.0 but nothing to my knowledge that would make SSR support worse.

Are you using nuxt.js for your SSR project? Have you tried whitelisting this component in some way during the initialization? Can you provide any more detail of how you're installing this component and your SSR configuration - I'm sorta ignorant on SSR usage so the more detail the better. Thanks.

@mikerogerz
Copy link
Author

I don't think it's actually related to the SSR usage.. it happened when changes were made to the build. I looked at the min'd source, and noticed that there are checks built into 2.0.1 to check if it's a browser or on the server.. and starting in 2.1.0 that no longer exists.

Something changed in this commit:
cfa0bc8

@johndatserakis
Copy link
Owner

Hey - yea idk this is a bit strange. Really only one dependency was updated in that commit - rollup-plugin-vue. A user over there has a question about ssr support here, maybe that can help.

Although - one thing I noticed that I took out because I didn't see it being used was the browser key in the package.json. I added that back right now and built again and pushed. Will you please update to the latest version of vue-programmatic-invisible-google-recaptcha - 2.1.3 and see if it's working for you now? I have a feeling that could be it. Thank you - let me know.

@mikerogerz
Copy link
Author

That might be the fix, but now I'm getting other compile-time errors regarding plugins in your .babelrc. My project isn't using Babel 7.. I'm still on 6. due to a few outdated 3rd party libraries. Here's what it reports:

ReferenceError: Unknown plugin "@babel/plugin-transform-runtime"

I might have to stay at version 2.0.1 of your library until I can get everything in my project upgraded.

@johndatserakis
Copy link
Owner

Hmm darn, I thought we were close! Although yea Babel 6 was released a while ago and may be the main issue here - it's hard to say.

Well, when you update to Babel 7 then maybe you can let us know if it starts working for you? I'll be standing by to hear how it goes. Thanks.

@mikerogerz
Copy link
Author

mikerogerz commented May 7, 2019 via email

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

No branches or pull requests

2 participants