
As such, you won't be able to input any command on that terminal until you stop watch's execution.

After running npm run watch, your currently opened terminal will continue to process the watch command's activities.Open your project's package.json file and add a watch property to its scripts field like so: In that case, you can add a watch property to your package.json's scripts field.įor instance, do the following: 1. Suppose you wish to automate the process of rerunning the build step. Luckily, webpack provides a way to automate the two tasks. Repeating the manual process of running the build step and refreshing your browser can be burdensome. Whenever you make changes to your source code, ensure to do the following for your updates to reflect in the browser: Important Stuff to Know about Updating Your App
#Why use webpack update#
You can do so by running npm update webpack webpack-cli on your terminal. In that case, you likely need to update your webpack dependency.

So, your HTML source code should look like this: Open your index.html source code file and delete the tag you previously used to reference webpack's distribution bundle. To make HtmlWebpackPlugin use your HTML source file as a template, do the following: 1.
#Why use webpack how to#
How to Make HtmlWebpackPlugin Use Your Source File as a Template to Auto-Generate a New HTML Page However, you can also tell HtmlWebpackPlugin to use your source file as a template. Instead, it automatically created a brand-new HTML page that includes only the bundles webpack generated. The HtmlWebpackPlugin omitted the content of the source code's element because it did not create the new file from the original document. In that case, the browser will open an empty HTML page. In other words, suppose you open the dist/index.html file in the browser. Notice that the HTML document generated by HtmlWebpackPlugin does not contain your source file's and elements.
