Skip to content

Update README about more Vuejs SSR hydration caveats #142

Closed
@maxmilton

Description

When using react-snap with vue and webpack + vue-loader there's an extra client side hydration caveat worth adding to the readme.

When using react-snap with the minifyHtml.collapseWhitespace = true option vue client side hydration will fail because, by default, vue-loader includes whitespace when creating its virtual DOM representation. Since the VDOM and the real DOM are different (VDOM has extra whitespace textNodes), hydration fails.

Took me a while to work out what was going on but it turns out there's an easy solution. In the vue-loader configuration just add preserveWhitespace: false. In the official templates this is found in the vue-loader.conf.js file. Info in the vue-loader docs.

If that doesn't make sense please let me know and I'll try to explain better or create an example repo.

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions