Add loadModule method to webpack laoder context

This commit is contained in:
Anthony Cleaver
2018-06-21 08:32:55 +01:00
parent 0897921174
commit 5c07db608d
2 changed files with 9 additions and 0 deletions
+8
View File
@@ -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.
*/
+1
View File
@@ -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');