1.1.0 • Published 2 years ago

@someok/webpack-build-info-plugin v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

webpack-build-info-plugin

webpack 打包后生成相关的 build-info.json

Install

# npm
npm i @someok/webpack-build-info-plugin -D

#yarn
yarn add @someok/webpack-build-info-plugin -D

Usage

const WebpackBuildInfoPlugin = require('@someok/webpack-build-info-plugin');

// webpack plugin
plugins = [

    new WebpackBuildInfoPlugin(),

]

Options

new WebpackBuildInfoPlugin(options)

options 为对象,支持属性有:

Option类型默认值说明
outputFilenamestringbuild-info.json输出文件名
outputGitInfobooleantrue是否输出 git commit hash,默认为 true
extraBuildPropertiesobject{}额外属性

Example

生成的 build-info.json 示例:

{
    "hash": "ba40d5cc6739654e271b",
    "startTime": 1631101585078,
    "endTime": 1631101655628,
    "osInfo": {
        "arch": "x64",
        "platform": "darwin",
        "release": "20.4.0",
        "type": "Darwin",
        "username": "abc"
    },
    "commitHash": "7cfb3d4fd954134b8576d1a4f7decb84da6901aa"
}