webpack study notes (c) the introduction of automatic export js file

html-webpack-plugin property at github View

Html html files generated by the module
1. Plug

cnpm i html-webpack-plugin --save-dev

After the installation finished there will be a warning: Here Insert Picture Description
do not install webpack installed directly in the project once on OK

cnpm i webpack --save-dev

Such installation is complete

2. Plug

// 引入模块
let HtmlWebpackPlugin = require("html-webpack-plugin")
plugins:[new htmlWebpackPlugin({
			//filename: 相对输出文件的的路径
            filename:'./index.html',
            //template: 模板为相对当前的配置文件路径
            //相对webpack.config.js 的路径
            template:'index.html'
        })
]

Re-packaged once the ok
**

注意

**
Before using the resources we have to set an access path publicPathso as to re-set the path packaged generated html file with respect .

Published 50 original articles · won praise 23 · views 1245

Guess you like

Origin blog.csdn.net/qq_44698161/article/details/102853796