File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -7,9 +7,17 @@ import { pathToFileURL } from 'node:url';
7
7
* @param {string } dependency
8
8
*/
9
9
export function resolve_peer_dependency ( dependency ) {
10
+ const [ major , minor ] = process . versions . node . split ( '.' ) . map ( Number ) ;
10
11
try {
12
+ const resolved = ( ( ) => {
13
+ if ( major >= 20 && minor >= 6 ) {
14
+ // @ts -expect-error the types are wrong
15
+ return import . meta. resolve ( dependency ) ;
16
+ }
17
+ // @ts -expect-error the types are wrong
18
+ return imr . resolve ( dependency , pathToFileURL ( process . cwd ( ) + '/dummy.js' ) ) ;
19
+ } ) ( ) ;
11
20
// @ts -expect-error the types are wrong
12
- const resolved = imr . resolve ( dependency , pathToFileURL ( process . cwd ( ) + '/dummy.js' ) ) ;
13
21
return import ( resolved ) ;
14
22
} catch {
15
23
throw new Error (
You can’t perform that action at this time.
0 commit comments