Merge pull request #14593 from tommytroylin/patch-1

[webpack] Update BannerPlugin definition
This commit is contained in:
Mine Starks
2017-03-06 17:58:29 -08:00
committed by GitHub
2 changed files with 27 additions and 3 deletions

17
webpack/index.d.ts vendored
View File

@@ -1,6 +1,6 @@
// Type definitions for webpack 2.2
// Project: https://github.com/webpack/webpack
// Definitions by: Qubo <https://github.com/tkqubo>, Matt Lewis <https://github.com/mattlewis92>, Benjamin Lim <https://github.com/bumbleblym>, Boris Cherny <https://github.com/bcherny>
// Definitions by: Qubo <https://github.com/tkqubo>, Matt Lewis <https://github.com/mattlewis92>, Benjamin Lim <https://github.com/bumbleblym>, Boris Cherny <https://github.com/bcherny>, Tommy Troy Lin <https://github.com/tommytroylin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
@@ -661,7 +661,20 @@ declare namespace webpack {
*/
class BannerPlugin extends Plugin {
constructor(banner: any, options: any);
constructor(options: string | BannerPlugin.Options);
}
namespace BannerPlugin {
type Filter = string | RegExp;
interface Options {
banner: string;
entryOnly?: boolean;
exclude?: Filter | Filter[];
include?: Filter | Filter[];
raw?: boolean;
test?: Filter | Filter[];
}
}
class ContextReplacementPlugin extends Plugin {

View File

@@ -257,7 +257,18 @@ plugin = new webpack.IgnorePlugin(requestRegExp, contextRegExp);
plugin = new webpack.PrefetchPlugin(context, request);
plugin = new webpack.PrefetchPlugin(request);
plugin = new webpack.BannerPlugin(banner, options);
plugin = new webpack.BannerPlugin('banner');
plugin = new webpack.BannerPlugin({
banner: 'banner'
});
plugin = new webpack.BannerPlugin({
banner: 'banner',
entryOnly: true,
exclude: /index/,
include: 'test',
raw: false,
test: ['test', /index/]
});
plugin = new webpack.optimize.DedupePlugin();
plugin = new webpack.optimize.LimitChunkCountPlugin(options);
plugin = new webpack.optimize.MinChunkSizePlugin(options);