Skip to content

Commit 9fdd2d8

Browse files
Merge pull request #4 from z00rat/master
also supports '[name].config.cjs'
2 parents 9c36c19 + 7fd7644 commit 9fdd2d8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

configent.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,16 @@ function configent(defaults, input = {}, configentOptions) {
103103
}
104104

105105
function getUserConfig() {
106-
const path = resolve(process.cwd(), `${name}.config.js`)
107-
return existsSync(path) ? require(path) : {}
106+
const path_js = resolve(process.cwd(), `${name}.config.js`)
107+
const path_cjs = resolve(process.cwd(), `${name}.config.cjs`)
108+
109+
if (existsSync(path_js)) {
110+
return require(path_js);
111+
} else if (existsSync(path_cjs)) {
112+
return require(path_cjs);
113+
} else {
114+
return {};
115+
}
108116
}
109117

110118
function getPackageConfig() {

0 commit comments

Comments
 (0)