nav tabs on admin dashboard
This commit is contained in:
+18
-15
@@ -37,9 +37,10 @@ const myResolver = ResolverFactory.createResolver({
|
||||
|
||||
// resolve a file with the new resolver
|
||||
const context = {};
|
||||
const resolveContext = {};
|
||||
const lookupStartPath = '/Users/webpack/some/root/dir';
|
||||
const request = './path/to-look-up.js';
|
||||
myResolver.resolve({}, lookupStartPath, request, (err/*Error*/, filepath/*string*/) => {
|
||||
myResolver.resolve({}, lookupStartPath, request, resolveContext, (err/*Error*/, filepath/*string*/) => {
|
||||
// Do something with the path
|
||||
});
|
||||
```
|
||||
@@ -48,21 +49,22 @@ For more examples creating different types resolvers (sync/async, context, etc)
|
||||
#### Resolver Options
|
||||
| Field | Default | Description |
|
||||
| ------------------------ | --------------------------- | ---------------------------------------------------------------------------------- |
|
||||
| modules | ["node_modules"] | A list of directories to resolve modules from, can be absolute path or folder name |
|
||||
| descriptionFiles | ["package.json"] | A list of description files to read from |
|
||||
| plugins | [] | A list of additional resolve plugins which should be applied |
|
||||
| mainFields | ["main"] | A list of main fields in description files |
|
||||
| aliasFields | [] | A list of alias fields in description files |
|
||||
| mainFiles | ["index"] | A list of main files in directories |
|
||||
| extensions | [".js", ".json", ".node"] | A list of extensions which should be tried for files |
|
||||
| enforceExtension | false | Enforce that a extension from extensions must be used |
|
||||
| moduleExtensions | [] | A list of module extensions which should be tried for modules |
|
||||
| enforceModuleExtension | false | Enforce that a extension from moduleExtensions must be used |
|
||||
| alias | [] | A list of module alias configurations or an object which maps key to value |
|
||||
| resolveToContext | false | Resolve to a context instead of a file |
|
||||
| unsafeCache | false | Use this cache object to unsafely cache the successful requests |
|
||||
| aliasFields | [] | A list of alias fields in description files |
|
||||
| cacheWithContext | true | If unsafe cache is enabled, includes `request.context` in the cache key |
|
||||
| descriptionFiles | ["package.json"] | A list of description files to read from |
|
||||
| enforceExtension | false | Enforce that a extension from extensions must be used |
|
||||
| enforceModuleExtension | false | Enforce that a extension from moduleExtensions must be used |
|
||||
| extensions | [".js", ".json", ".node"] | A list of extensions which should be tried for files |
|
||||
| mainFields | ["main"] | A list of main fields in description files |
|
||||
| mainFiles | ["index"] | A list of main files in directories |
|
||||
| modules | ["node_modules"] | A list of directories to resolve modules from, can be absolute path or folder name |
|
||||
| unsafeCache | false | Use this cache object to unsafely cache the successful requests |
|
||||
| plugins | [] | A list of additional resolve plugins which should be applied |
|
||||
| symlinks | true | Whether to resolve symlinks to their symlinked location |
|
||||
| cachePredicate | function() { return true }; | A function which decides whether a request should be cached or not. An object is passed to the function with `path` and `request` properties. |
|
||||
| moduleExtensions | [] | A list of module extensions which should be tried for modules |
|
||||
| resolveToContext | false | Resolve to a context instead of a file |
|
||||
| fileSystem | | The file system which should be used |
|
||||
| resolver | undefined | A prepared Resolver to which the plugins are attached |
|
||||
|
||||
@@ -80,9 +82,10 @@ class MyResolverPlugin {
|
||||
}
|
||||
|
||||
apply(resolver) {
|
||||
resolver.plugin(this.source, (request, callback) => {
|
||||
const target = resolver.ensureHook(this.target);
|
||||
resolver.getHook(this.source).tapAsync("MyResolverPlugin", (request, resolveContext, callback) => {
|
||||
// Any logic you need to create a new `request` can go here
|
||||
resolver.doResolve(this.target, request, null, callback);
|
||||
resolver.doResolve(target, request, null, resolveContext, callback);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user