re: Setup React, Babel 7, and Webpack 4 VIEW POST


I don't know if it's because I was using npm but I was receiving the error

Uncaught Error: Target container is not a DOM element.

Once I removed the lines

"plugins: [
new HtmlWebpackPlugin({
inject: false,
template: HtmlWebpackTemplate,
appMountId: 'app',

from my webpack.config.js file this solution worked pefectly

Easiest solution on the internet in 2019.
Although the line "yarn add react react-dom" could be a little bit more visible


Html Webpack plugin injects a index.html file for you with a div element containing an ID of “app”. Did you happen to be using a separate index.html file?

code of conduct - report abuse