New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@wjtools/version-webpack-plugin

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wjtools/version-webpack-plugin

webpack 版本号自动更新插件

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
2
Created
Source

@wjtools/version-webpack-plugin

一个简易的 webpack 版本号自动更新插件

安装

首先,您需要安装 @wjtools/version-webpack-plugin:

$ yarn add @wjtools/version-webpack-plugin --save-dev

然后将插件添加到您的 webpack 配置。例如:

vue.config.js

configureWebpack: config => {
  if (isProd) {
    // 自动更新 package.json 中的版本号
    const VersionWebpackPlugin = require('@wjtools/version-webpack-plugin')
    config.plugins.push(
      new VersionWebpackPlugin({
        // file: 'package.json', // 指定版本号所在文件,默认:'package.json'
        // version: '1.0.0', // 指定版本号,默认取 file 指定文件中的版本号
        // mode: 'increment', // 更新模式:increment-递增(默认);timestamp-时间戳
      }),
    )
  }
},

使用

每次打包会生成新的递增的版本号,直接导入即可使用,例如:

main.js

import { version } from '../package'

版本号兼容 1.x.xx.xx 等写法

Keywords

webpack

FAQs

Package last updated on 01 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts