Skip to content

bingqichen/webpack-version-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

webpack-version-plugin

使用

npm

$ npm install webpack-version-plugin --save-dev

yarn

$ yarn add webpack-version-plugin --dev
const webpack = require('webpack');
const WebpackVersionPlugin = require('webpack-version-plugin');

module.exports = {
  entry: {
    app: 'src/app',
    vendor: ['react', 'react-dom']
  },
  output: {
    path: 'dist/',
    filename: 'js/[name]_[hash:8].js',
    publicPath: 'cdn_path'
  },
  plugins: [
    new WebpackVersionPlugin({
      cb: function(hashMap) {
        console.log(hashMap);
        /* do something, the hashMap like this:
        {
          hash: 'fa74f31052feddb3032256f018063b88',
          chunkHash: {
            app: '4089fbc1699ec5b6009b0f9bfcdc8327',
            vendor: 'ff7f0450afc7ff3030cba2428e593dcf'
          }
        }*/
      }
    }),
    ...
  ]
}

起源

About

webpack 提取 hash、chunkhash 版本号插件

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published