mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 23:37:04 +00:00
Merge pull request #14663 from bumbleblym/webpack
[webpack] fix AggressiveMergingPlugin
This commit is contained in:
Vendored
+22
-4
@@ -783,10 +783,28 @@ declare namespace webpack {
|
||||
|
||||
namespace optimize {
|
||||
class AggressiveMergingPlugin extends Plugin {
|
||||
constructor(options?: {
|
||||
minSize?: number;
|
||||
maxSize?: number;
|
||||
});
|
||||
constructor(options?: AggressiveMergingPlugin.Options);
|
||||
}
|
||||
|
||||
namespace AggressiveMergingPlugin {
|
||||
interface Options {
|
||||
/**
|
||||
* When options.moveToParents is set, moving to an entry chunk is more expensive.
|
||||
* Defaults to 10, which means moving to an entry chunk is ten times more expensive than moving to a
|
||||
* normal chunk.
|
||||
*/
|
||||
entryChunkMultiplicator?: number;
|
||||
/**
|
||||
* A factor which defines the minimum required size reduction for chunk merging.
|
||||
* Defaults to 1.5 which means that the total size needs to be reduced by 50% for chunk merging.
|
||||
*/
|
||||
minSizeReduce?: number;
|
||||
/**
|
||||
* When set, modules that are not in both merged chunks are moved to all parents of the chunk.
|
||||
* Defaults to false.
|
||||
*/
|
||||
moveToParents?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
class CommonsChunkPlugin extends Plugin {
|
||||
|
||||
@@ -1,6 +1,33 @@
|
||||
|
||||
import * as webpack from 'webpack';
|
||||
|
||||
const {
|
||||
optimize,
|
||||
} = webpack;
|
||||
|
||||
let plugins: webpack.Plugin[];
|
||||
|
||||
/**
|
||||
* Plugins
|
||||
*/
|
||||
|
||||
/**
|
||||
* optimize
|
||||
*/
|
||||
|
||||
const {
|
||||
AggressiveMergingPlugin,
|
||||
} = optimize;
|
||||
|
||||
plugins = [
|
||||
new AggressiveMergingPlugin(),
|
||||
new AggressiveMergingPlugin({}),
|
||||
new AggressiveMergingPlugin({
|
||||
entryChunkMultiplicator: 10,
|
||||
minSizeReduce: 1.5,
|
||||
moveToParents: false,
|
||||
}),
|
||||
];
|
||||
|
||||
let configuration: webpack.Configuration;
|
||||
let rule: webpack.Rule;
|
||||
let plugin: webpack.Plugin;
|
||||
@@ -236,7 +263,6 @@ declare const context: any;
|
||||
declare const request: any;
|
||||
declare const types: any;
|
||||
declare const banner: any;
|
||||
const plugins: webpack.Plugin[] = [];
|
||||
|
||||
plugin = new webpack.NormalModuleReplacementPlugin(resourceRegExp, newResource);
|
||||
plugin = new webpack.ContextReplacementPlugin(
|
||||
@@ -334,7 +360,6 @@ plugin = new CommonsChunkPlugin({
|
||||
// minChunks: 3,
|
||||
// (3 children must share the module before it's separated)
|
||||
});
|
||||
plugin = new webpack.optimize.AggressiveMergingPlugin(options);
|
||||
plugin = new webpack.DefinePlugin(definitions);
|
||||
plugin = new webpack.DefinePlugin({
|
||||
"VERSION": JSON.stringify("5fa3b9"),
|
||||
|
||||
Reference in New Issue
Block a user