webpack常用插件

 

1 copy-webpack-plugin

Copies individual files or entire directories, which already exist, to the build directory
webpack-copy-plugin is not designed to copy files generated from the build process; rather, it is to copy files that already exist in the source tree, as part of the build process.

## copy文件到打包的文件夹当中,只能copy已经存在的文件

 

2 filemanager-webpack-plugin

This Webpack plugin allows you to copy, archive (.zip/.tar/.tar.gz), move, delete files and directories before and after builds

## 文件管理插件,可以在打包前以及打包后 对所有的文件进行拷贝,压缩,移动,删除等相关操作

 

3 html-webpack-plugin

This is a webpack plugin that simplifies creation of HTML files to serve your webpack bundles.

## 以一个html文件为模板,生成一个html文件,并将打包生成的js文件注入当中

 

4 Clean plugin for webpack

By default, this plugin will remove all files inside webpack's output.path directory, as well as all unused webpack assets after every successful rebuild

## 只会移除webpack's output.path directory 目录下的文件,(比如你生成的目录是dist,那么它只会移除dist下面的文件,但是不包含dist本身)

 

5 webpack.ProvidePlugin

new webpack.ProvidePlugin({
    $: 'jquery',
    _: 'lodash'
})

## 垫片插件 ,当我们在代码中使用到相关的变量,但是没有引入相关的模块时,该插件会自动帮我们引入

 

6 add-asset-html-webpack-plugin

After webpack 4+, it is required to apply AddAssetHtmlPlugin after HtmlWebpackPlugin

## 必须要在HtmlWebpackPlugin插件之后使用它,往生成的html文件当中额外插入资源文件

 

7 webpack.DllReferencePlugin

new webpack.DllReferencePlugin({
    manifest: path.resolve(__dirname, './dll', file)
}), 

## 当打包第三方模块时,首先会通过这个映射去查找,查看这个模块是否被打包,如果找不到再去node_modules

 

转载于:https://www.cnblogs.com/panrui1994/p/11525821.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值