webpack#StatsCompilation TypeScript Examples
The following examples show how to use
webpack#StatsCompilation.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: duplicatePackages.ts From reskript with MIT License | 5 votes |
extractUniqueModules = (compilations: StatsCompilation[]): string[] => {
const modules = compilations.flatMap(c => c.modules);
const names = modules.map(m => m?.nameForCondition);
return uniq(reject(isNil, names));
}
Example #2
Source File: htmlImportable.ts From reskript with MIT License | 5 votes |
extractScriptEntries = (compilations: StatsCompilation[]): string[] => {
const entries = compilations.flatMap(c => Object.values(c.entrypoints ?? {}));
// 这里的`assets`是有顺序的(大概),被别人依赖的在前面(大概),真正的入口是最后一个(大概)
return uniq(reject(isNil, entries.map(v => last(v.assets ?? [])?.name)));
}
Example #3
Source File: htmlImportable.ts From reskript with MIT License | 5 votes |
extractHTMLEntries = (compilations: StatsCompilation[]): string[] => {
const assets = compilations.flatMap(c => c.assets ?? []);
const files = assets.filter(v => /^\.\.\/.+\.html$/.test(v.name)).map(v => v.name);
return files;
}
Example #4
Source File: initialResources.ts From reskript with MIT License | 5 votes |
extractInitialChunks = (compilations: StatsCompilation[]) => {
const chunks = uniqBy(chunk => chunk.id, compilations.flatMap(child => child.chunks ?? []));
const initialChunks = chunks.filter(chunk => chunk.initial);
return initialChunks;
}