diff --git a/definitions/npm/webpack_v5.x.x/flow_v0.104.x-/test_webpack_v5.x.x.js b/definitions/npm/webpack_v5.x.x/flow_v0.104.x-/test_webpack_v5.x.x.js index 6bc6fc39af..a2199f7d4f 100644 --- a/definitions/npm/webpack_v5.x.x/flow_v0.104.x-/test_webpack_v5.x.x.js +++ b/definitions/npm/webpack_v5.x.x/flow_v0.104.x-/test_webpack_v5.x.x.js @@ -163,4 +163,31 @@ describe('webpack', () => { ] }); }); + + test('ProvidePlugin', () => { + webpack({ + plugins: [ + new webpack.ProvidePlugin({ + process: 'process/browser.js', + foo: ['bar', 'baz'], + }), + ] + }); + + webpack({ + plugins: [ + new webpack.ProvidePlugin({ + // $FlowExpectedError[incompatible-call] + foo: 1, + }), + ] + }); + + webpack({ + plugins: [ + // $FlowExpectedError[incompatible-call] + new webpack.ProvidePlugin('test'), + ] + }); + }); }); diff --git a/definitions/npm/webpack_v5.x.x/flow_v0.104.x-/webpack_v5.x.x.js b/definitions/npm/webpack_v5.x.x/flow_v0.104.x-/webpack_v5.x.x.js index 005bda999d..f7b9c2f20f 100644 --- a/definitions/npm/webpack_v5.x.x/flow_v0.104.x-/webpack_v5.x.x.js +++ b/definitions/npm/webpack_v5.x.x/flow_v0.104.x-/webpack_v5.x.x.js @@ -769,6 +769,16 @@ declare module 'webpack' { ) => (percentage: number, msg: string, ...args: $ReadOnlyArray) => void; } + declare class ProvidePlugin { + constructor(definitions: { [key: string]: string | string[] }): $NonMaybeType[number]; + definitions: { [key: string]: string | string[] }; + + /** + * Apply the plugin + */ + apply(compiler: WebpackCompiler | WebpackMultiCompiler): void; + } + declare function builder( options: WebpackOptions, callback?: Callback @@ -786,6 +796,7 @@ declare module 'webpack' { HotModuleReplacementPlugin: typeof HotModuleReplacementPlugin, ContextReplacementPlugin: typeof ContextReplacementPlugin, ProgressPlugin: typeof ProgressPlugin, + ProvidePlugin: typeof ProvidePlugin, ... }; }