I use hjs for several of my projects and it’s awesome!
However, I ran into a weird issue that I didn’t manage to solve on my own… HMR works like a charm, but when I manually reload the page (eg when I edit a component) everything is broken and I got a blank page with the following console message:
Uncaught Invariant Violation: _registerComponent(...): Target container is not a DOM element.
I also noticed this only happen when HMR happened at least once, when I launch hjs-dev-server for the first time, I can reload as much time as I want, but when I edit a component and it get hot reloaded, I can’t manually reload anymore…
Here is my index.js in case it can help:
import React from 'react'
import ReactDOM from 'react-dom'
import Console from './components/Console'
import 'styles/main.css'
ReactDOM.render(
<Console />,
document.getElementById('app')
)
Hello,
I use
hjs
for several of my projects and it’s awesome!However, I ran into a weird issue that I didn’t manage to solve on my own… HMR works like a charm, but when I manually reload the page (eg when I edit a component) everything is broken and I got a blank page with the following console message:
Uncaught Invariant Violation: _registerComponent(...): Target container is not a DOM element.
Here is my
webpack.config.js
:I tried to add this:
but it still won’t allow manual reload…
I also noticed this only happen when HMR happened at least once, when I launch
hjs-dev-server
for the first time, I can reload as much time as I want, but when I edit a component and it get hot reloaded, I can’t manually reload anymore…Here is my
index.js
in case it can help:I tried to wrap the rendering like this:
But it didn't work either…
Any idea about this? Is it related to
hjs
orreact
itself?Thanks for all this great work btw!