webpack4.0: html plug-in

We print a word in the entry file:

 

 After packing the new index.html file in the dist directory generated by the introduction of export documents generated after the package:

 

 Then open insex.html local file, open the console:

If we want to open the index.html file in the form of localhost:

  npm i  webpack-dev-server -D

  npx webpack-dev-server

 

 In the address bar, enter http: // localhost: 8080:

 

 But we hope that in the dist directory:

Adding package.json file: "dev": "webpack-dev-server"

 

 在webpack.config.js:

Execution npm run dev

 

 

html plug-in processing:

1.npm i html-webpack-plugin -D

2.

3.

 

 

 

 

Guess you like

Origin www.cnblogs.com/zxmonster/p/12006651.html