We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9c92dcc commit 304aa72Copy full SHA for 304aa72
src/lib/internal/RootScan.ts
@@ -1,4 +1,4 @@
1
-import { readFileSync } from 'fs';
+import { existsSync, readFileSync } from 'fs';
2
import { dirname, join } from 'path';
3
4
/**
@@ -82,7 +82,9 @@ export function parseRootData(): RootData {
82
try {
83
file = JSON.parse(readFileSync(join(cwd, 'package.json'), 'utf8')) as PartialPackageJson;
84
} catch (error) {
85
- return { root: cwd, type: 'CommonJS' };
+ const hasDenoConfigFile = existsSync(join(cwd, 'deno.json'));
86
+ const hasBunConfigFile = existsSync(join(cwd, 'bunfig.toml'));
87
+ return hasDenoConfigFile || hasBunConfigFile ? { root: cwd, type: 'ESM' } : { root: cwd, type: 'CommonJS' };
88
}
89
90
const { main: packageMain, module: packageModule, type: packageType } = file;
0 commit comments