How to use git-revision-webpack-plugin - 2 common examples

To help you get started, we’ve selected a few git-revision-webpack-plugin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ethibox / ethibox / webpack.config.babel.js View on Github external
import 'babel-polyfill';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import BrowserSyncPlugin from 'browser-sync-webpack-plugin';
import CopyWebpackPlugin from 'copy-webpack-plugin';
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import UglifyJsPlugin from 'uglifyjs-webpack-plugin';
import GitRevisionPlugin from 'git-revision-webpack-plugin';
import webpack from 'webpack';

const env = process.env.NODE_ENV || 'development';
const port = process.env.PORT || 4444;
const gitRevisionPlugin = new GitRevisionPlugin({ lightweightTags: true });

const config = {
    entry: {
        index: [
            './src/client/js/index.js',
            './src/client/css/main.scss',
        ],
    },
    output: {
        path: `${__dirname}/public/static/`,
        filename: (env === 'production') ? 'bundle-[hash].js' : 'bundle.js',
        publicPath: '/',
    },
    module: {
        rules: [
            { test: /\.html$/, use: 'html-loader?minimize=false' },
github bitcrowd / tickety-tick / webpack.common.js View on Github external
config.plugin('extract')
  .use(MiniCssExtractPlugin, [{
    filename: '[name].css',
  }]);

config.plugin('copy')
  .use(CopyWebpackPlugin, [[
    {
      from: src.common('icons', '*.png'),
      flatten: true,
    },
  ], {
    copyUnmodified: true,
  }]);

const revision = new GitRevisionPlugin();

config.plugin('revision')
  .use(revision);

config.plugin('define')
  .after('revision')
  .use(DefinePlugin, [{
    COMMITHASH: JSON.stringify(revision.commithash()),
  }]);

config.plugin('notifier')
  .use(NotifierPlugin, [{
    title: 'Tickety-Tick Build',
  }]);

config.devtool('source-map');

git-revision-webpack-plugin

[![npm version](https://badge.fury.io/js/git-revision-webpack-plugin.svg)](https://badge.fury.io/js/git-revision-webpack-plugin) [![downloads](https://img.shields.io/npm/dm/git-revision-webpack-plugin.svg?style=flat-square)](https://www.npmjs.com/package/

MIT
Latest version published 4 years ago

Package Health Score

56 / 100
Full package analysis

Popular git-revision-webpack-plugin functions

Similar packages