syntax-tree/hast-to-hyperscript

react(h) fail to work properly in webpack -p

kthjm opened this issue · 3 comments

kthjm commented

Im using rehype-react, But when bundle with uglify (webpack -p), style attribute stored in hast isn't reflected to view.

I looked it up, It seems the cause is node._store.

to #L174

to #L25

result

: process.env.NODE_ENV === "development" (work)

: process.env.NODE_ENV === "production" (not work)

I don't know why this caused, But parseStyle don't work because r === false.

Oh bummer!

Would you be interested in creating a PR to fix the react(h) function to work with dev and prod mode?

kthjm commented

oh im interested, thanks. which is better way ?

  • just remove node._store
  • replace with node._owner === null