Skip to content

Commit 1a5e3e4

Browse files
authored
fix: handle esm config when checking for conditionNames (#231)
Fix loading the default module exports when config is ESM to suppress the warning of checking "resolve.conditionNames".
1 parent a90bcb4 commit 1a5e3e4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

index.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ function posixify(file) {
88
return file.replace(/[/\\]/g, '/');
99
}
1010

11+
function interopEsmDefault(mod) {
12+
return mod && mod.__esModule && mod.default ? mod.default : mod;
13+
}
14+
1115
const virtualModules = new Map();
1216
let index = 0;
1317

@@ -26,7 +30,7 @@ for (let i = 0; i < process.argv.length; i++) {
2630

2731
try {
2832
const configPath = path.resolve(process.cwd(), configFile);
29-
const config = require(configPath);
33+
const config = interopEsmDefault(require(configPath));
3034
let found = false;
3135
if (Array.isArray(config)) {
3236
found = config.some(check);

0 commit comments

Comments
 (0)