kodyl / react-document-meta

HTML meta tags for React-based apps. Works for both client- and server-side rendering, and has a strict but flexible API.
MIT License
320 stars 23 forks source link

doesn't work with preact-compat #36

Closed yocontra closed 7 years ago

yocontra commented 7 years ago

Not sure if you're interested in fixing this, but since this module always requires the server-side react-dom (even on the frontend!) it doesn't work with preact (via preact-compat) since preact-compat/server is not a thing.

Even if you don't care about preact, we should probably fix this to reduce the amount of code going into front-end only builds.

danieljuhl commented 7 years ago

@contra this is definitely something we should fix.. the only solution I see at the moment will require a breaking change. I'll try to make a v3-beta release today.

danieljuhl commented 7 years ago

@contra As I don't have any preact applications at the moment, do you mind help me test the beta once it's ready?

danieljuhl commented 7 years ago

@contra please try react-document-meta@next (resolving to 3.0.0-beta.0), if you use any of the two SSR methods DocumentMeta.renderAsHTML() or DocumentMeta.renderToStaticMarkup() then DocumentMeta must be imported from react-document-meta/server. Nothing else is changed..

yocontra commented 7 years ago

@danieljuhl I'll give it a whirl, thanks!

If you want to test it, here's the aliases I'm using in webpack:

alias: {
    'preact-compat': 'preact-compat/dist/preact-compat',
    react: 'preact-compat',
    'react-dom': 'preact-compat',
    'create-react-class': 'preact-compat/lib/create-react-class'
}
yocontra commented 7 years ago

Seems to have done the trick, I'll close this now - thanks again for the quick response.