From 05cec665da3d3003ceed13aa43dc683091505db7 Mon Sep 17 00:00:00 2001 From: Stephanie Yu Date: Tue, 29 May 2018 21:03:46 -0400 Subject: [PATCH] Add optimization class to webpack-chain typings --- types/webpack-chain/index.d.ts | 28 ++++++++++++++++++++++ types/webpack-chain/webpack-chain-tests.ts | 21 ++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/types/webpack-chain/index.d.ts b/types/webpack-chain/index.d.ts index 6f6c46daa8..1a18737bc2 100644 --- a/types/webpack-chain/index.d.ts +++ b/types/webpack-chain/index.d.ts @@ -47,6 +47,7 @@ declare class Config extends __Config.ChainedMap { module: Config.Module; node: Config.ChainedMap; output: Config.Output; + optimization: Config.Optimization; performance: Config.Performance; plugins: Config.Plugins; resolve: Config.Resolve; @@ -198,6 +199,33 @@ declare namespace Config { post(): this; } + class Optimization extends ChainedMap { + concatenateModules(value: boolean): this; + flagIncludedChunks(value: boolean): this; + mergeDuplicateChunks(value: boolean): this; + minimize(value: boolean): this; + minimizer(value: webpack.Plugin[]): this; + namedChunks(value: boolean): this; + namedModules(value: boolean): this; + nodeEnv(value: boolean | string): this; + noEmitOnErrors(value: boolean): this; + occurrenceOrder(value: boolean): this; + portableRecords(value: boolean): this; + providedExports(value: boolean): this; + removeAvailableModules(value: boolean): this; + removeEmptyChunks(value: boolean): this; + runtimeChunk(value: boolean | "single" | "multiple" | RuntimeChunk): this; + sideEffects(value: boolean): this; + splitChunks(value: SplitChunksOptions): this; + usedExports(value: boolean): this; + } + + interface RuntimeChunk { + name: string | Function; + } + + interface SplitChunksOptions { [name: string]: any; } + interface LoaderOptions { [name: string]: any; } class Use extends ChainedMap { diff --git a/types/webpack-chain/webpack-chain-tests.ts b/types/webpack-chain/webpack-chain-tests.ts index 07593687cf..387162fb07 100644 --- a/types/webpack-chain/webpack-chain-tests.ts +++ b/types/webpack-chain/webpack-chain-tests.ts @@ -150,6 +150,27 @@ config .umdNamedDefine(true) .end() + .optimization + .concatenateModules(true) + .flagIncludedChunks(true) + .mergeDuplicateChunks(true) + .minimize(true) + .minimizer([]) + .namedChunks(true) + .namedModules(true) + .nodeEnv(true) + .noEmitOnErrors(true) + .occurrenceOrder(true) + .portableRecords(true) + .providedExports(true) + .removeAvailableModules(true) + .removeEmptyChunks(true) + .runtimeChunk("single") + .sideEffects(true) + .splitChunks({}) + .usedExports(true) + .end() + .performance .hints(true) .hints('warning')