|
8 | 8 | createFilesMatcher,
|
9 | 9 | parseTsconfig,
|
10 | 10 | } from 'get-tsconfig'
|
11 |
| -import { type Version } from 'is-bun-module' |
12 | 11 | import { ResolverFactory } from 'rspack-resolver'
|
13 | 12 | import { stableHash } from 'stable-hash'
|
14 | 13 |
|
@@ -67,24 +66,16 @@ export const resolve = (
|
67 | 66 | ): ResolvedResult => {
|
68 | 67 | options ||= {}
|
69 | 68 |
|
70 |
| - let bunVersion = process.versions.bun as Version | undefined |
71 |
| - |
72 |
| - // don't worry about bun core modules |
73 |
| - if (bunVersion || options.bun) { |
74 |
| - if ( |
75 |
| - bunVersion |
76 |
| - ? module.isBuiltin(source) |
77 |
| - : (isBunModule ??= module.createRequire(_filename)( |
78 |
| - 'is-bun-module', |
79 |
| - ) as IsBunModule).isBunModule(source, (bunVersion = 'latest')) || |
80 |
| - isBunModule.isSupportedNodeModule(source, bunVersion) |
81 |
| - ) { |
82 |
| - log('matched bun core:', source) |
83 |
| - return { found: true, path: null } |
84 |
| - } |
85 |
| - } else if (module.isBuiltin(source)) { |
86 |
| - // don't worry about node core modules |
87 |
| - log('matched node core:', source) |
| 69 | + // don't worry about node/bun core modules |
| 70 | + if ( |
| 71 | + module.isBuiltin(source) || |
| 72 | + (options.bun && |
| 73 | + ((isBunModule ??= module.createRequire(_filename)( |
| 74 | + 'is-bun-module', |
| 75 | + ) as IsBunModule).isBunModule(source, 'latest') || |
| 76 | + isBunModule.isSupportedNodeModule(source, 'latest'))) |
| 77 | + ) { |
| 78 | + log('matched core:', source) |
88 | 79 | return { found: true, path: null }
|
89 | 80 | }
|
90 | 81 |
|
|
0 commit comments