[webpack] Add resolve.plugins

This commit is contained in:
Michael Strobel
2017-04-12 09:39:16 +08:00
parent db665dd659
commit 2b9bfe8eae
2 changed files with 20 additions and 0 deletions
+9
View File
@@ -264,6 +264,11 @@ declare namespace webpack {
*/
cachePredicate?(data: { path: string, request: string }): boolean;
/**
* A list of additional resolve plugins which should be applied.
*/
plugins?: ResolvePlugin[];
/**
* Whether to resolve symlinks to their symlinked location.
*
@@ -594,6 +599,10 @@ declare namespace webpack {
apply(compiler: Compiler): void;
}
abstract class ResolvePlugin implements Tapable.Plugin {
apply(resolver: any /* EnhancedResolve.Resolver */): void;
}
abstract class Stats {
/** Returns true if there were errors while compiling. */
hasErrors(): boolean;
+11
View File
@@ -577,7 +577,18 @@ configuration = {
}
};
class TestResolvePlugin implements webpack.ResolvePlugin {
apply(resolver: any) {
resolver.plugin('before-existing-directory', (request: any, callback: any) => {
callback();
});
}
}
const resolve: webpack.Resolve = {
plugins: [
new TestResolvePlugin()
],
symlinks: false,
cachePredicate: 'boo' // why does this test _not_ fail!?
};