Skip to content

[React 15+] Cloudflare's HTML minification causes isomorphic React app to crash #10778

Description

@gaulucky92

I think this is not a bug, it's a compatibility issue.

In React v15.x+, the server-sided HTML rendered by react-dom/server's function renderToString() contains some comment tags that represent null components (instead of <noscript> tags like React v0.14.x), which is really neat.
Unfortunately, when the app is served by Cloudflare with HTML minification enabled, it automatically removes all the comment tags, including the ones generated by React.
This behavior causes the client app to crash, and throws an error:

Unable to find element with ID x.

With x is a number, usually the null component's react-id.

The problem can be solved by disabling HTML minification on Cloudflare, but the question is, is it possible to earn the benefit from HTML minification, while keep the app running well?

React/ReactDOM version: 15.6.1
Node version: 6.10.0 / 6.10.3

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions