diff --git a/types/webpack-env/index.d.ts b/types/webpack-env/index.d.ts index 01ef65fc18..441cbaf9db 100644 --- a/types/webpack-env/index.d.ts +++ b/types/webpack-env/index.d.ts @@ -34,6 +34,7 @@ declare namespace __WebpackModuleApi { * * This creates a chunk. The chunk can be named. If a chunk with this name already exists, the dependencies are merged into that chunk and that chunk is used. */ + ensure(paths: string[], callback: (require: NodeRequire) => void, chunkName?: string): void; ensure(paths: string[], callback: (require: NodeRequire) => void, errorCallback?: (error: any) => void, chunkName?: string): void; context(path: string, deep?: boolean, filter?: RegExp, mode?: "sync" | "eager" | "weak" | "lazy" | "lazy-once"): RequireContext; /** diff --git a/types/webpack-env/webpack-env-tests.ts b/types/webpack-env/webpack-env-tests.ts index 1907416c61..987a8f49fe 100644 --- a/types/webpack-env/webpack-env-tests.ts +++ b/types/webpack-env/webpack-env-tests.ts @@ -84,5 +84,14 @@ if (module.hot) { module.hot.removeStatusHandler(statusHandler); } +require.ensure([], (require) => { + require("some/module"); +}); +require.ensure([], (require) => { + require("some/module"); +}, (e) => {}, 'chunkWithErrorHandling') +require.ensure([], (require) => { + require("some/module"); +}, 'chunkWithoutErrorHandling');