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 server side rendering with (not only) Nuxt #77

Merged
merged 2 commits into from
Jul 15, 2019

Conversation

farin
Copy link
Contributor

@farin farin commented Aug 26, 2018

Fixes nuxt/nuxt#995

Browser File API is not available when server side rendering
is used in Nuxt universal app.

This error can't be easilly solved outside vue-picture-input.
Although Nuxt provides variable to distinguish client/server
rendering this bug occurs just by importing PictureInput. Because
conditional input is not easilly possible with ES6 only workaround
is direct patch of PictureInput.

Sadly I don't find easy way how to write test. @vue/test-utils mocks
File object despite vue-server-renderer is used. But in a real Nuxt
app File is undefined.

Without testUrl
"SecurityError: localStorage is not available for opaque origins"
errors happens with latest jsdom.
Refer jsdom/jsdom#2304 to more detail information.

Also shallow deprecation has been resolved.
Fixes nuxt/nuxt#995

Browser File API is not available when server side rendering
is used in Nuxt universal app.

This error can't be easilly solved outside vue-picture-input.
Although Nuxt provides variable to distinguish client/server
rendering this bug occurs just by importing PictureInput. Because
conditional input is not easilly possible with ES6 only workaround
is direct patch of PictureInput.

Sadly I don't find easy way how to write test. @vue/test-utils mocks
File object despite vue-server-renderer is used. But in a real Nuxt
app File is undefined.
@alessiomaffeis alessiomaffeis merged commit 8994030 into alessiomaffeis:master Jul 15, 2019
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.

Lib vue-picture-input not working with SSR
2 participants