Added the id property to RequireContext as described here: https://webpack.js.org/guides/dependency-management/#context-module-api (#36676)

This commit is contained in:
Ryan Lamansky 2019-07-10 15:49:00 -05:00 committed by Armando Aguirre
parent 1ff5fa1ba1
commit 128496570a
2 changed files with 5 additions and 1 deletions

View File

@ -1,4 +1,4 @@
// Type definitions for webpack (module API) 1.13
// Type definitions for webpack (module API) 1.14
// Project: https://github.com/webpack/webpack
// Definitions by: use-strict <https://github.com/use-strict>
// rhonsby <https://github.com/rhonsby>
@ -15,6 +15,8 @@ declare namespace __WebpackModuleApi {
(id: string): any;
<T>(id: string): T;
resolve(id: string): string;
/** The module id of the context module. This may be useful for module.hot.accept. */
id: string;
}
interface RequireFunction {

View File

@ -13,6 +13,8 @@ otherModule.otherMethod();
let context = require.context('./somePath', true);
let contextModule = context<SomeModule>('./someModule');
const contextId: string = require.context('./somePath').id;
require(['./someModule', './otherModule'], (someModule: SomeModule, otherModule: any) => {
});