diff --git a/webpack/index.d.ts b/webpack/index.d.ts index 4f6ae6e211..d21716a6e8 100644 --- a/webpack/index.d.ts +++ b/webpack/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for webpack 2.2 // Project: https://github.com/webpack/webpack -// Definitions by: Qubo , Matt Lewis , Benjamin Lim , Boris Cherny +// Definitions by: Qubo , Matt Lewis , Benjamin Lim , Boris Cherny , Tommy Troy Lin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -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 { diff --git a/webpack/webpack-tests.ts b/webpack/webpack-tests.ts index c1369f78bc..8ab05c1de4 100644 --- a/webpack/webpack-tests.ts +++ b/webpack/webpack-tests.ts @@ -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);