When we package the webpackjs file, we introduce the global main.js in the index.html interface, as shown below:
src ='budl.js'
must be introduced
When packaging, the unpacked files are divided into two files, one is a local disk file and the other is a file in the memory. Isn't this particularly troublesome? Faced with this problem, we have another way to solve it. html-webpack-plugin
installs this plug-in.
1. We first enter npm i html-webpack-plugin
to install the plug-in
2. Then configure the options in the webpack.config.js configuration file.
Installation completed
webpack.config.js introduces html-webpack-plugin
Configure the generated interface file
3. After the plug-in is installed, comment the src=budle.js in the index, and then restart the project
4. After restarting the project, the interface will automatically package a buld.js and introduce it in the index interface.
SummarizeThe above is the editor's introduction to using html-webpack-plugin' to generate html page plug-ins in memory. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. . I would also like to thank everyone for your support of the VeVb martial arts website!