Skip to content

Commit 58d81e3

Browse files
fix: set missing root property to config (#38)
1 parent 0151662 commit 58d81e3

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/config/src/lib/config.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,19 @@ const importUp = async <T>(dir: string, name: string): Promise<T> => {
4747
for (const ext of extensions) {
4848
const filePathWithExt = `${filePath}${ext}`;
4949
if (fs.existsSync(filePathWithExt)) {
50+
let config: T;
51+
5052
if (ext === '.mjs') {
51-
return import(filePathWithExt).then((module) => module.default);
53+
config = await import(filePathWithExt).then((module) => module.default);
5254
} else {
5355
const require = createRequire(import.meta.url);
54-
return require(filePathWithExt);
56+
config = require(filePathWithExt);
5557
}
58+
59+
return {
60+
root: dir,
61+
...config,
62+
};
5663
}
5764
}
5865

0 commit comments

Comments
 (0)