Skip to content

Commit

Permalink
fix: add conditionNames support (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Jun 27, 2022
1 parent 40eb62e commit c74fe0e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/index.ts
Expand Up @@ -55,6 +55,16 @@ const defaultMainFields = [
'main',
]

const defaultConditionNames = [
'types',
'import',
'require',
'node',
'node-addons',
'browser',
'default',
]

export const interfaceVersion = 2

export interface TsResolverOptions
Expand All @@ -63,6 +73,7 @@ export interface TsResolverOptions
project?: string[] | string
extensions?: string[]
packageFilter?: (pkg: Record<string, string>) => Record<string, string>
conditionNamesMapper?: Record<string, string[]>
}

const fileSystem = fs as FileSystem
Expand All @@ -88,6 +99,7 @@ export function resolve(
...options,
extensions: options?.extensions ?? defaultExtensions,
mainFields: options?.mainFields ?? defaultMainFields,
conditionNames: options?.conditionNames ?? defaultConditionNames,
fileSystem,
useSyncFileSystemCalls: true,
}
Expand Down

0 comments on commit c74fe0e

Please sign in to comment.