npm.io
1.0.0 • Published 7 years ago

webpack-matching-filefields

Licence
ISC
Version
1.0.0
Deps
0
Size
6 kB
Vulns
0
Weekly
0

webpack-matching-filefields

兼容性

  • 兼容webpack从0~4的任何版本

作用

  • 检测指定字符串/正则是否在webpack所打包的模块中

传入参数

  • 传入单个字符串或正则,若需要判断多个字符/正则,将其作为数组成员放入数组传入 例如:['testField',/regField/] 或 'testField' 或 /regField/ 都可以

如何使用

  • 在webpack的配置文件中引入: const MatchingFileFields = require('webpack-matching-filefields') <-你的插件所在路径
  • 在plugins中实例化并传入参数(例如我想检测字符串testField、正则/regField/): new MatchingFileFields(['testField',/regField/]) <-结果会在执行命令后输出展示在控制台
  • 在此附一段简单的webpack配置代码:

const MatchingFileFields = require('webpack-matching-filefields') module.exports = { mode: 'none', entry: './main.js', output: { filename: '[name].js', path: path.resolve(__dirname, 'dist') }, plugins: [ new MatchingFileFields(['testField',/regField/]) ]}


## 显示
- 结果会在执行命令后输出展示在控制台

## 依赖
- 需要在你的项目内安装 colors 模块来显示色彩

Keywords