# webpack-build-version-file-plugin

> webpack生成构建版本文件插件

Latest version **1.0.0** (published 2021-07-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install webpack-build-version-file-plugin
pnpm add webpack-build-version-file-plugin
yarn add webpack-build-version-file-plugin
bun add webpack-build-version-file-plugin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-07-12 |
| First published | 2021-07-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | 463393074@qq.com |
| Maintainers | 463393074 |

## Links

- npm: https://www.npmjs.com/package/webpack-build-version-file-plugin
- npm.io page: https://npm.io/package/webpack-build-version-file-plugin

## Recent versions

- 1.0.0 (latest) — 2021-07-12

## README

## 安装

```bash
npm install --save-dev webpack-version-file-plugin
```

## 使用

`webpack.config.js`

```javascript
const VersionFilePlugin = require('webpack-version-file-plugin');

module.exports = {
  // ...
  plugins: [new VersionFilePlugin()],
};
```

默认会生成一个 version.json 的文件，内容如下:

```json
{
  "hash": "3c84397d21aef9fe86528a5b12a8bbbe"
}
```

## API

```js
// webpack.config.js

module.exports = {
  // ...
  plugins: [
    new VersionFilePlugin({
      filePath: 'version.json',
      serialize: function (json) {
        return JSON.stringify(json, null, 2);
      },
    }),
  ],
};
```

### `options.filePath`

Type: `String`<br>
Default: `version.json`

生成文件路径

### `options.serialize`

Type: `Function(Object): string`<br>
Default: `(json) => JSON.stringify(json, null, 2)`

文件内容序列化方法

---
_Source: https://npm.io/package/webpack-build-version-file-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
