How to use the webpack.BannerPlugin function in webpack

To help you get started, we’ve selected a few webpack 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 katspaugh / wavesurfer.js / build-config / fragments / banner.js View on Github external
/* eslint-env node */

const path = require('path');
const webpack = require('webpack');
const datefns = require('date-fns');

const rootDir = path.resolve(__dirname, '..', '..');
const date = datefns.format(new Date(), 'yyyy-MM-dd');
const pckg = require(path.join(rootDir, 'package.json'));

// library JS banner with copyright and version info
// prettier-ignore
const jsBanner = `${pckg.name} ${pckg.version} (${date})
${pckg.homepage}
@license ${pckg.license}`;
const libBanner = new webpack.BannerPlugin({
    banner: jsBanner,
    test: /\.js$/
});

// plugin JS banner with copyright and version info
// prettier-ignore
const jsPluginBanner = `${pckg.name} [name] plugin ${pckg.version} (${date})
${pckg.homepage}
@license ${pckg.license}`;
const pluginBanner = new webpack.BannerPlugin({
    banner: jsPluginBanner,
    test: /\.js$/
});

module.exports = { libBanner, pluginBanner };
github EYHN / hexo-helper-live2d / webpack.config.cJs.dev.js View on Github external
],
  output: { // Set cJs.min output
    filename: "cLive2d.min.js",
    path: __dirname + "/dist"
  },

  devtool: "source-map",

  plugins: [
    new webpack.DefinePlugin({ // Set the development environment
      'process.env': {
        'NODE_ENV': JSON.stringify('development')
      }
    }),

    new webpack.BannerPlugin("DEVELOPING BUILD\nhttps://github.com/EYHN/hexo-helper-live2d -The file is creted at " + new Date()),

    new Visualizer(), // https://github.com/chrisbateman/webpack-visualizer
                      // visualizer generator

    new webpack.optimize.UglifyJsPlugin({ // Compress cJs
      compress: true,
      warnings: true,
      sourceMap: true,
      mangle: true
    }),

    new HtmlWebpackPlugin({ // Generate dev page
      filename: 'dev.html',
      template: "./src/tmplate/dev.tmpl.html",
      hash: true,
      showErrors: true,
github bilibiliou / kuolun / webpack.config.js View on Github external
let webpack  = require('webpack'),
    path     = require('path'),
    fs       = require('fs'),
    manifest = require('./manifest.json'),
    {resolve, join} = path,
    env = process.env.NODE_ENV;

let plugins = [
    new webpack.BannerPlugin(
        fs
          .readFileSync('./LICENSE')
          .toString('utf-8')),
    new webpack.DllReferencePlugin({context: __dirname, manifest})
];

// if (env === 'pro') {

// } else {
//  plugins.push()
// }

let config = {
        // context: resolve(__dirname, 'src'), 
    entry: {
        app: [
github iuap-design / tinper-neoui / webpack.config.js View on Github external
var fs = require('fs');
var glob = require('glob');

var dir_js = path.resolve(__dirname, 'src');
var dir_build = path.resolve(__dirname, 'dist/js');


var data = fs.readFileSync('./package.json', 'utf8');
var packageObj = JSON.parse(data);
var headerStr = '';
headerStr += packageObj.name + ' v' + packageObj.version + '\r\n';
headerStr += packageObj.description + '\r\n';
headerStr += 'author : ' + packageObj.author + '\r\n';
headerStr += 'homepage : ' + packageObj.homepage + '\r\n';
headerStr += 'bugs : ' + packageObj.bugs.url;
var plugins = [new webpack.BannerPlugin(headerStr),
    new webpack.LoaderOptionsPlugin({
        minimize: true
    })
    // new webpack.NoErrorsPlugin()
]

var returnFUn = function(env) {
    var mode = env.mode,
        outputFile;

    if (mode == 'build') {
        outputFile = '[name].min.js';
        plugins.push(new webpack.optimize.UglifyJsPlugin({
            mangle: true,
            beautify: true
        }))
github Rebelizer / pellet / src / manifest.js View on Github external
}
        },
        externals:[{
          React: 'React',
          react: 'React',
          intl: 'intl'
        }],
        plugins:[
          new webpack.optimize.DedupePlugin(),
          //new webpack.NoErrorsPlugin(),
          new webpack.DefinePlugin({
            'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
            'process.env.SERVER_ENV': JSON.stringify(false),
            'process.env.BROWSER_ENV': JSON.stringify(true)
          }),
          new webpack.BannerPlugin(
            options.copyright +
            '\nDate: '+new Date().toJSON()
          )
        ]
      }], browser, {arrayCopyMode:2});

      // allow dev to target the version of react, intl, ejs
      // i.e. does webpack use pellet react version or the calling
      // projects version
      var externalDependencies;
      if(options.useInternalDependencies) {
        externalDependencies = {};
        if(fs.existsSync(path.resolve(options.projectRootPath, 'node_modules', 'pellet', 'node_modules', 'react'))) {
          externalDependencies.React = path.join('pellet', 'node_modules', 'react', 'addons');
          externalDependencies.react = externalDependencies.React;
        } else {
github FMS-Cat / automaton / webpack.config.js View on Github external
],
    },
    optimization: {
      minimize: !DEV
    },
    devServer: {
      contentBase: path.resolve( __dirname, './' ),
      publicPath: '/dist/',
      openPage: 'index.html',
      watchContentBase: true,
      inline: true,
      hot: true
    },
    devtool: DEV ? 'inline-source-map' : false,
    plugins: [
      new webpack.BannerPlugin( banner ),
      new webpack.DefinePlugin( {
        'process.env': {
          DEV,
          VERSION: `"${ VERSION }"`
        },
      } ),
      ...( DEV ? [
        new webpack.NamedModulesPlugin(),
        new ForkTsCheckerWebpackPlugin( { checkSyntacticErrors: true } ),
      ] : [
        // nothing
      ] ),
    ],
  };
};
github joesmith100 / timrjs / webpack.config.js View on Github external
*
 * Compatible with Browsers, Node.js (CommonJS) and RequireJS.
 *
 * Copyright (c) 2016 Joe Smith
 * Released under the MIT license
 * https://github.com/joesmith100/timrjs/blob/master/LICENSE.md
 */`;

if (process.env.NODE_ENV === 'production') {
  bannerText = `/* TimrJS v${version} | (c) 2016 Joe Smith | https://github.com/joesmith100/timrjs */`;

  config.plugins.push(new webpack.optimize.UglifyJsPlugin());
}

config.plugins.push(
  new webpack.BannerPlugin({ banner: bannerText, raw: true })
);

module.exports = config;
github sahat / satellizer / webpack.config.js View on Github external
entry: './dist/ng1.js',

  output: {
    filename: 'satellizer.js',
    path: path.join(__dirname, 'examples', 'client', 'vendor'),
    library: 'satellizer',
    libraryTarget: 'umd',
    umdNamedDefine: true
  },

  plugins: [
    // new webpack.optimize.UglifyJsPlugin({
    //   include: /.js$/, minimize: true
    // }),
    new webpack.BannerPlugin(banner)
  ],

  module: {
    loaders: [
      { test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ }
    ]
  }
};
github fontIconPicker / react-fonticonpicker / webpack.config.js View on Github external
const banner = `
React FontIconPicker

React Component to show a picker element to pick font-icons & svg

@author Swashata Ghosh 
@version ${pkg.version}
@link https://github.com/fontIconPicker/react-fonticonpicker
@license MIT

Copyright (c) ${new Date().getFullYear()} Swashata Ghosh 

This software is released under the MIT License.
https://opensource.org/licenses/MIT
`;
const addBanner = new webpack.BannerPlugin({
	banner,
	raw: false,
	entryOnly: true,
	include: /\.(js|jsx|css)$/,
});
const extractSass = new ExtractTextPlugin({
	filename: 'fonticonpicker.[name].react.css',
});

module.exports = {
	entry: {
		fonticonpicker: path.join(__dirname, 'src/js/FontIconPicker.js'),
		'base-theme': path.join(__dirname, 'src/js/ThemeBase.js'),
		'material-theme': path.join(__dirname, 'src/js/ThemeMaterial.js'),
	},
	output: {
github OpenNMS / opennms-js / webpack.config.js View on Github external
'global.OPENNMS_JS_VERSION': JSON.stringify(pkginfo.version),
  };

  myconf.mode = options.production? 'production':'development';

  if (options.target === 'web') {
    myconf.target = 'web';
  } else {
    myconf.target = 'node';
    myconf.node = { process: false };
  }

  if (options.target === 'node') {
    myconf.output.filename += '.node';
    myconf.entry.cli = __dirname + '/src/CLI.ts';
    myconf.plugins.push(new webpack.BannerPlugin({
      banner: '#!/usr/bin/env node',
      raw: true,
      entryOnly: true,
      include: /cli/i,
    }));
  }

  if (!myconf.optimization) {
    myconf.optimization = {};
  }

  if (!options.production) {
    myconf.module.rules.unshift({
      test: /(\.tsx?)$/,
      use: [
        'cache-loader',