mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
Add support for chunks filter function in SplitChunksPlugin
This commit is contained in:
Vendored
+2
-2
@@ -560,7 +560,7 @@ declare namespace webpack {
|
||||
/** Assign modules to a cache group */
|
||||
test?: ((...args: any[]) => boolean) | string | RegExp;
|
||||
/** Select chunks for determining cache group content (defaults to \"initial\", \"initial\" and \"all\" requires adding these chunks to the HTML) */
|
||||
chunks?: "initial" | "async" | "all";
|
||||
chunks?: "initial" | "async" | "all" | ((chunk: any, index?: number, chunks?: any[]) => boolean);
|
||||
/** Ignore minimum size, minimum chunks and maximum requests and always create chunks for this cache group */
|
||||
enforce?: boolean;
|
||||
/** Priority of this cache group */
|
||||
@@ -580,7 +580,7 @@ declare namespace webpack {
|
||||
}
|
||||
interface SplitChunksOptions {
|
||||
/** Select chunks for determining shared modules (defaults to \"async\", \"initial\" and \"all\" requires adding these chunks to the HTML) */
|
||||
chunks?: "initial" | "async" | "all";
|
||||
chunks?: "initial" | "async" | "all" | ((chunk: any, index?: number, chunks?: any[]) => boolean);
|
||||
/** Minimal size for the created chunk */
|
||||
minSize?: number;
|
||||
/** Minimum number of times a module has to be duplicated until it's considered for splitting */
|
||||
|
||||
@@ -607,6 +607,27 @@ configuration = {
|
||||
},
|
||||
};
|
||||
|
||||
configuration = {
|
||||
mode: "production",
|
||||
optimization: {
|
||||
splitChunks: {
|
||||
cacheGroups: {
|
||||
common: {
|
||||
name: 'common',
|
||||
chunks(chunk: { name: string }) {
|
||||
const allowedChunks = [
|
||||
'renderer',
|
||||
'component-window',
|
||||
];
|
||||
return allowedChunks.indexOf(chunk.name) >= 0;
|
||||
},
|
||||
minChunks: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
plugin = new webpack.SplitChunksPlugin({ chunks: "async", minChunks: 2 });
|
||||
|
||||
class SingleEntryDependency extends webpack.compilation.Dependency {}
|
||||
|
||||
Reference in New Issue
Block a user