Git Product home page Git Product logo

git-sha-webpack-plugin's Introduction

git-sha-webpack-plugin

Allows tagging a webpack bundle or chunk with the Git SHA of the latest commit affecting that bundle. Useful for when you want to use long-term caching of your bundles, but want to tie the hash to something real and traceable.

Usage

Install via npm:

npm install git-sha-webpack-plugin

And then require for use in webpack:

// in webpack.config.js (or similar)
var GitSHAPlugin = require('git-sha-webpack-plugin');

module.exports = {
  
  // your config values here

  output: {
    filename: '[chunkgitsha].js'
  },
  plugins: [
    new GitSHAPlugin({shaLength: 7})
  ]
}

Options

shaLength

Allows truncating the SHA to a specific character length. 7 by default.

git-sha-webpack-plugin's People

Contributors

bebraw avatar diurnalist avatar joscarsson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

git-sha-webpack-plugin's Issues

chunkgitsha not included in generated stats

First of all, thanks for a great plugin :)

I have a slight issue where the chunkgitsha does not seem to be included in the stats output (so I can't refer to it afterwards). I usually do something like:

var webpack = require('webpack');
var webpackConfig = require('../webpack-production.config');

webpack(webpackConfig, function(err, stats) {
  var jsonstats = stats.toJson({ hash: true, chunkgitsha: true });
  console.log('hash', jsonstats.hash); // this is the webpack compilation hash
  console.log('chunkgitsha', jsonstats.chunkgitsha); // this is undefined
});

Would it be possible to include that in stats somehow?

Also, it would be great with an option to just get the latest commit's sha instead of the latest commit sha that affected the bundle. Maybe another variable, [gitsha] in addition to [chunkgitsha]?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.