Skip to content

Commit 28e7f08

Browse files
authored
fix(cli): Attempt to verify non-cjs modules exist if cjs resolution fails (#7310) (#7313)
1 parent 25cbdb0 commit 28e7f08

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cli/src/util/node.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { readFileSync } from '@ionic/utils-fs';
2+
import { existsSync } from 'fs';
23
import { resolve } from 'path';
34
import type typescript from 'typescript';
45

@@ -56,6 +57,10 @@ export function resolveNode(
5657
try {
5758
return require.resolve(pathSegments.join('/'), { paths: [root] });
5859
} catch (e) {
60+
const path = [root, 'node_modules', ...pathSegments].join('/');
61+
if (existsSync(path)) {
62+
return path;
63+
}
5964
return null;
6065
}
6166
}

0 commit comments

Comments
 (0)