diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index d482955d2c..62c2b41f1e 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -1594,6 +1594,14 @@ declare namespace webpack { */ exec(code: string, filename: string): any; + /** + * Resolves the given request to a module, applies all configured loaders and calls + * back with the generated source, the sourceMap and the module instance (usually an + * instance of NormalModule). Use this function if you need to know the source code + * of another module to generate the result. + */ + loadModule(request: string, callback: (err: Error, source: string, sourceMap: RawSourceMap, module: Module) => void): any; + /** * Resolve a request like a require expression. */ diff --git a/types/webpack/webpack-tests.ts b/types/webpack/webpack-tests.ts index 913eea0b19..c1f5fc4897 100644 --- a/types/webpack/webpack-tests.ts +++ b/types/webpack/webpack-tests.ts @@ -516,6 +516,7 @@ function loader(this: webpack.loader.LoaderContext, source: string | Buffer, sou this.addDependency(''); + this.loadModule('path', (err: Error, result: string, sourceMape: RawSourceMap, module: webpack.Module) => { }); this.resolve('context', 'request', (err: Error, result: string) => { }); this.emitWarning('warning message');