Webpack Front-End build Tool Learning Summary (iv) HTML pages in an automated build project

Source: Internet
Author: User
Follow above: Webpack front-end build Tool Learning Summary (iii) of the Webpack.config.js configuration file

1. Install the Html-webpack-plugin plugin, enter the command:npm install Html-webpack-plugin--save-dev

2. In the Webpack.config.js file, introduce the Html-webpack-plugin plugin

3. Input command: NPM run Webpack, compile package

Can see in the Dist/js directory of the new generation into a index.html file, and introduced the newly compiled generated two JS, but this index.html and the SRC folder below the index.html is not related

SRC below the index.html below

4. If you build a new HTML on this basis, you need to configure the parameters of the HTML plugin inside the Webpack.config.js

After compiling the package, the file directory under Dist is as follows:

Compile the generated index.html file as follows

5. But we do not want the HTML file and JS file in the same level directory, modify the output property value in the Webpack.config.js file in the normal project.

Input command: NPM run Webpack, after compiling the packaged directory for

Webpack Front-End build Tool Learning Summary (iv) HTML pages in an automated build project

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.