[webpack-env] Add overload for require.ensure that omits the errorCallback (#39046)

This commit is contained in:
Retsam 2019-10-14 15:05:22 -04:00 committed by Andrew Branch
parent 855c080456
commit 47659c6960
2 changed files with 10 additions and 0 deletions

View File

@ -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;
/**

View File

@ -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');