iansinnott / react-static-webpack-plugin

Build full static sites using React, React Router and Webpack (Webpack 2 supported)
MIT License
155 stars 24 forks source link

Error: Invariant Violation: _registerComponent(...): Target container is not a DOM element. #45

Closed BerkeleyTrue closed 7 years ago

BerkeleyTrue commented 7 years ago

Trying to upgrade to v2 on my boilerplate sites results in this error above. It seems that the change in environment is causing react to look for DOM elements. I'm digging in deeper but his shows up now in two projects I've tried to upgrade.

I've got a branch to demonstrate the error https://github.com/BerkeleyTrue/immortan-boilerplate/tree/fix/RSWP-test

BerkeleyTrue commented 7 years ago

Turns out this was a build error on my part. I was using the existence of the DOM globals to determine whether or not to call render with document.getElement, which returns null in the build step.