Use html-webpack-plugin' to generate HTML page plugin in memory

Use html-webpack-plugin' to generate HTML page plugin in memory

When we package the webpackjs file, we introduce the global main.js in the index.html interface, as shown below:

Must import src ='budl.js'

When packaging, the unpacked files are divided into two files, one is a local disk file, and the other is a file in memory. This is very troublesome. In the face of this problem, we have a solution. Install this plug-in html-webpack-plugin

1. First, we enter npm i html-webpack-plugin to install the plug-in

2. Then configure the options in the webpack.config.js configuration file.

Installation Complete

webpack.config.js introduces html-webpack-plugin

Configure the generated interface file

3. After the plugin is installed, comment out the src="budle.js" of index and restart the project.

4. After restarting the project, the interface will automatically package a buld.js and import it in the index interface

Summarize

The above is the editor's introduction to using html-webpack-plugin' to generate HTML page plug-in in memory. I hope it will be helpful to everyone. 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 their support of the 123WORDPRESS.COM website!

<<:  Detailed explanation of JSONObject usage

>>:  Deploy grafana+prometheus configuration using docker

Recommend

Detailed explanation of grep and egrep commands in Linux

rep / egrep Syntax: grep [-cinvABC] 'word'...

Detailed explanation of the basic use of centos7 firewall in linux

1. Basic use of firewalld start up: systemctl sta...

Detailed explanation of the life cycle of Angular components (Part 2)

Table of contents 1. View hook 1. Things to note ...

Detailed explanation of common methods of JavaScript arrays

Table of contents Common array methods pop() unsh...

Detailed explanation of the platform bus of Linux driver

Table of contents 1. Introduction to platform bus...

Example of Vue transition to achieve like animation effect

Table of contents Results at a Glance Heart Effec...

js implements a simple calculator

Use native js to implement a simple calculator (w...

MySQL Oracle and SQL Server paging query example analysis

Recently, I have done a simple study on the data ...

404 error occurs when accessing the homepage of tomcat started in Docker mode

Scenario: When starting tomcat in docker (version...

Disable autocomplete in html so it doesn't show history

The input box always displays the input history wh...

How to use union all in MySQL to get the union sort

Sometimes in a project, due to some irreversible ...