Skip to content

Commit 4009af3

Browse files
committed
fix: support windows absolute path in extends
1 parent f09e55f commit 4009af3

File tree

3 files changed

+25
-13
lines changed

3 files changed

+25
-13
lines changed

lib/get-config.js

+3-13
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { dirname, extname } from "node:path";
1+
import { dirname } from "node:path";
22
import { fileURLToPath } from "node:url";
33

44
import { castArray, isNil, isPlainObject, isString, pickBy } from "lodash-es";
55
import { readPackageUp } from "read-pkg-up";
66
import { cosmiconfig } from "cosmiconfig";
7-
import resolveFrom from "resolve-from";
7+
import importFrom from "import-from-esm";
88
import debugConfig from "debug";
99
import { repoUrl } from "./git.js";
1010
import PLUGINS_DEFINITIONS from "./definitions/plugins.js";
@@ -33,17 +33,7 @@ export default async (context, cliOptions) => {
3333
options = {
3434
...(await castArray(extendPaths).reduce(async (eventualResult, extendPath) => {
3535
const result = await eventualResult;
36-
const resolvedPath = resolveFrom.silent(__dirname, extendPath) || resolveFrom(cwd, extendPath);
37-
const importAssertions =
38-
extname(resolvedPath) === ".json"
39-
? {
40-
assert: {
41-
type: "json",
42-
},
43-
}
44-
: undefined;
45-
46-
const { default: extendsOptions } = await import(resolvedPath, importAssertions);
36+
const extendsOptions = (await importFrom.silent(__dirname, extendPath)) || (await importFrom(cwd, extendPath));
4737

4838
// For each plugin defined in a shareable config, save in `pluginsPath` the extendable config path,
4939
// so those plugin will be loaded relative to the config file

package-lock.json

+21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"git-log-parser": "^1.2.0",
4444
"hook-std": "^3.0.0",
4545
"hosted-git-info": "^7.0.0",
46+
"import-from-esm": "^1.2.1",
4647
"lodash-es": "^4.17.21",
4748
"marked": "^9.0.0",
4849
"marked-terminal": "^6.0.0",

0 commit comments

Comments
 (0)