1. 10
    Inject a JavaScript bundle into HTML with the HtmlWebpackPlugin
    3m 1s

Inject a JavaScript bundle into HTML with the HtmlWebpackPlugin

InstructorAndy Van Slaars

Share this video with your friends

Send Tweet

Even if it's only a simple one, we'll need to serve up an HTML file to run our JavaScript app. We can hardcode the bundle path into a script tag, but then if we want to change our bundle name, we need to update that in our webpack config and in our html file. In this lesson, we'll see how to use the HtmlWebpackPlugin to inject the script tag for our bundle into an HTML template file.

Fisker Karma
Fisker Karma
~ 2 years ago

At this step, I am getting the following error: Uncaught Error: Target container is not a DOM element in console and in terminal, a verbose error log saying how it doesnt recognize html template. Please help with this. Thanks!

AJ Villalobos
AJ Villalobos
~ 2 years ago

You can try downloading the github code from this episode and compare. I had a problem too earlier, the console is outputting a.render is not a function. Silly typo where I imported react instead of react-dom.

AJ Villalobos
AJ Villalobos
~ 2 years ago

You can try downloading the github code from this episode and compare. I had a problem too earlier, the console is outputting a.render is not a function. Silly typo where I imported react instead of react-dom.