Recently, I used Dynamically add hash after each compile for external resources such as script and link introduced in HTML files to prevent problems with referencing cached external files You can generate and create HTML entry files. For example, a single page can generate an HTML file entry. Configuring N 1. Installation cnpm i webpack-plugin -D 2. Reference in webpack.config.json const path = require('path') const htmlWebpackPlugin = require('html-webpack-plugin') //First stepmodule.exports = { entry: path.join(__dirname, './src/main.js'), output: { path: path.join(__dirname, './dist'), filename: 'bundle.js', }, mode: 'development', devServer: { open: true, port: 8080, hot: true, contentBase: 'src' }, plugins: [ new htmlWebpackPlugin({ //Step 2 template: path.join(__dirname, './src/index.html'), //Specify the path of the generated template filename: 'index.html' //Specify the name of the generated page }) ] } 3. The role of html-webpack-plugin 1. Generate a file of the specified template in memory, which is faster to access 2. Automatically add bundle.js file to the specified template file Summarize This is the end of this article on the detailed use of html-webpack-plugin. For more information on the use of html-webpack-plugin, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! |
<<: Detailed explanation of the background-position percentage principle
>>: Why does your height:100% not work?
What you will learn 1. Software installation and ...
Today is 618, and all major shopping malls are ho...
First we must understand that a TCP socket in the...
1. First, an error message is reported when assoc...
How to install MySQL 5.7.18 on Linux 1. Download ...
<br />Related articles: innerHTML HTML DOM i...
Table of contents Install Software Management Ano...
dl:Definition list Definition List dt:Definition t...
Table of contents 1. Build local storage 2. Creat...
introduction In this article, we will introduce h...
This article shares the specific code of Vue recu...
MySQL official website download address: https://...
background nginx-kafka-module is a plug-in for ng...
50 lines of code to change 5 skin colors, includi...
Now most of the Docker images are based on Debian...