Using the html-webpack-plugin plug-in to start the page can put the html page into memory to increase the page loading speed and automatically set the path of the JS file introduced in the index.html page Prerequisite: Webpack is installed in the project. Steps: Step 1. Enter Step 2 : Modify the configuration file of webpack.config.js after the plug-in is installed Import the html-webpack-plugin plug-in in the configuration file and configure the template page path and the generated page name. const path = require("path") // Import html-webpack-plugin const htmlWebpackPlugin = require("html-webpack-plugin") module.exports={ entry:path.join(__dirname,"./src/main.js"), output:{ path:path.join(__dirname,"./dist"), filename:"bundle.js" }, //Configure plugin nodes plugins:[ // Create html-webpack-plugin plugin new htmlWebpackPlugin({ // Set parameters template:path.join(__dirname,"./src/index.html"), // Specify the template page to generate the page in memory according to the specified page filename:"index.html" // Specify the name of the generated page in memory }) ] } After using the html-webpack-plugin plug-in, there is no need to manually process the reference path of bundle.js because the correct path of bundle.js has been automatically introduced in the generated HTML page in memory. Summary - What plugins do: 1. Automatically generate a page in memory based on the specified page 2. Automatically introduce the packaged bundle.js into the page This is the end of this article about the tutorial on how to use the html webpack plugin. For more information about the html webpack plugin, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future! |
<<: How to set MySQL foreign keys for beginners
>>: Nginx rtmp module compilation arm version problem
Everyone must know the composition of the box mod...
sshd SSH is the abbreviation of Secure Shell, whi...
1. Solution 1.1 Describing the interface context-...
Table of contents What is Docker Client-side Dock...
Table of contents Preface Browser compiled versio...
Vue - implement the shuttle box function, the eff...
translate(-50%,-50%) attributes: Move it up and l...
Note: It is recommended that the virtual machine ...
1. Go to the location where you want to store the...
Table of contents Preface Publish-Subscriber Patt...
Uninstall MySQL 1. In the control panel, uninstal...
Overview binlog2sql is an open source MySQL Binlo...
Common scenarios of MySQL: getting the intersecti...
Table of contents Preface No.1 A focus No.2 Extra...
Table of contents Variable type and storage space...