mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
webpack: add missing uglifyjs plugin typings (#14177)
This commit is contained in:
committed by
Mohamed Hegazy
parent
756433aeb4
commit
02c09ed9d8
13
webpack/index.d.ts
vendored
13
webpack/index.d.ts
vendored
@@ -472,6 +472,17 @@ declare namespace webpack {
|
||||
apply(thisArg: Webpack, ...args: any[]): void;
|
||||
}
|
||||
|
||||
type UglifyCommentFunction = (astNode: any, comment: any) => boolean
|
||||
|
||||
interface UglifyPluginOptions extends UglifyJS.MinifyOptions {
|
||||
beautify?: boolean;
|
||||
comments?: boolean | RegExp | UglifyCommentFunction;
|
||||
sourceMap?: boolean;
|
||||
test?: Condition | Condition[];
|
||||
include?: Condition | Condition[];
|
||||
exclude?: Condition | Condition[];
|
||||
}
|
||||
|
||||
interface Webpack {
|
||||
(config: Configuration, callback?: compiler.CompilerCallback): compiler.Compiler;
|
||||
/**
|
||||
@@ -1020,7 +1031,7 @@ declare namespace webpack {
|
||||
new (preferEntry: boolean): Plugin;
|
||||
}
|
||||
interface UglifyJsPluginStatic {
|
||||
new (options?: UglifyJS.MinifyOptions): Plugin;
|
||||
new (options?: UglifyPluginOptions): Plugin;
|
||||
}
|
||||
interface CommonsChunkPluginStatic {
|
||||
new (chunkName: string, filenames?: string | string[]): Plugin;
|
||||
|
||||
@@ -288,11 +288,24 @@ plugin = new webpack.optimize.UglifyJsPlugin({
|
||||
warnings: false
|
||||
}
|
||||
});
|
||||
plugin = new webpack.optimize.UglifyJsPlugin({
|
||||
sourceMap: false,
|
||||
comments: true,
|
||||
beautify: true,
|
||||
test: 'foo',
|
||||
exclude: /node_modules/,
|
||||
include: 'test'
|
||||
});
|
||||
plugin = new webpack.optimize.UglifyJsPlugin({
|
||||
mangle: {
|
||||
except: ['$super', '$', 'exports', 'require']
|
||||
}
|
||||
});
|
||||
plugin = new webpack.optimize.UglifyJsPlugin({
|
||||
comments: function(astNode: any, comment: any) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
plugin = new webpack.optimize.CommonsChunkPlugin(options);
|
||||
plugin = new CommonsChunkPlugin({
|
||||
name: "commons",
|
||||
|
||||
Reference in New Issue
Block a user