Webpack学习(二)

来源:互联网 发布:备考六级英语听力软件 编辑:程序博客网 时间:2024/05/24 06:17

5.创建项目文件,如下图所示:

这里写图片描述

6.webpack主要用到三种插件,插件均通过cnpm install 插件名
(1)html-webpack-plugin

new htmlWebpackPlugin({            template: 'index.html',            filename: 'index.html',            inject: false,            minify: {                 //压缩Html                removeComments: true, //除去注释                collapseWhitespace: true //除去空格            }        })

(2)copy-webpack-plugin

new copyWebpackPlugin([            { from: 'app/views/**' },            { from: 'app/resource/**' },            { from: 'app/images/**' }        ])

(3)clean-webpack-plugin

new cleanWebpackPlugin(['build'], {})
原创粉丝点击