This is not a new issue, have been reported by other users too, the problem is I have tried many solutions but I am not able to get rid of this error, and strangely it doesn't cause any problem in running the app, all works fine, then why it throws error, is must be doing some damage to the app which I am not able to figure out.
Following are the things I have tried, but nothing works
Putting
<script src="/bundle.js"></script>
in the end of</body>
tag, after</body>
tag inside</html>
tag.Added
type="text/javascript"
which was one the solution.Added
async
in<script>
tag.
Moreover I have upgraded webpack from version 1 to latest one, and I landed to the this error, I easily come to a conclusion that webpack had some bug or, something?
Following is the error stack I am receiving..
Uncaught Error: _registerComponent(...): Target container is not a DOM
element. at invariant (12:44) at Object._renderNewRootComponent
(369:310) at Object._renderSubtreeIntoContainer (369:401) at
Object.render (369:422) at eval (729:78) at Object.
(bundle.js?61622f7508eae70357c3:4906) at webpack_require
(bundle.js?61622f7508eae70357c3:20) at Object.
(bundle.js?61622f7508eae70357c3:4562) at webpack_require
(bundle.js?61622f7508eae70357c3:20) at
bundle.js?61622f7508eae70357c3:63
The same issue I have reported in webpack issue tracker here
My index.html and render function looks like this
index.html
<!DOCTYPE html>
<html>
<head>
<base href="<%= htmlWebpackPlugin.options.baseHref %>">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div id="root" class="container-fluid"></div>
</body>
<script type="text/javascript" src="/build.js"></script>
</html>
Render
ReactDOM.render(
<Provider store={store}>
<MainApp />
</Provider>
, document.getElementById('root')
);
Thanks for helping..