1 |
|
2 |
|
3 | const ResolverFactory = require('enhanced-resolve/lib/ResolverFactory') as typeof import('enhanced-resolve').ResolverFactory;
|
4 |
|
5 | import { ModuleResolver } from './types';
|
6 | import { MinimalFS } from './cached-process-file';
|
7 |
|
8 | const resolverContext = {};
|
9 |
|
10 | export function createDefaultResolver(fileSystem: MinimalFS, resolveOptions: any): ModuleResolver {
|
11 | const eResolver = ResolverFactory.createResolver({
|
12 | useSyncFileSystemCalls: true,
|
13 | fileSystem,
|
14 | ...resolveOptions,
|
15 | });
|
16 |
|
17 | return (directoryPath, request) =>
|
18 | eResolver.resolveSync(resolverContext, directoryPath, request);
|
19 | }
|