fix: resolve path correctly when importing plugin (#1705)

This commit is contained in:
Artemeey
2024-09-04 16:51:10 +03:00
committed by GitHub
parent 1002e80f40
commit 81a1ecace6
2 changed files with 7 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"@redocly/cli": patch
---
Fixed the absolute path for importing plugins in Windows.

View File

@@ -1,4 +1,5 @@
import * as path from 'path';
import { pathToFileURL } from 'url';
import { existsSync } from 'fs';
import { isAbsoluteUrl } from '../ref-utils';
import { pickDefined, isNotString, isString, isDefined, keysOf } from '../utils';
@@ -145,7 +146,7 @@ export async function resolvePlugins(
return __non_webpack_require__(absolutePluginPath);
} else {
// you can import both cjs and mjs
const mod = await _importDynamic(absolutePluginPath);
const mod = await _importDynamic(pathToFileURL(absolutePluginPath).href);
return mod.default || mod;
}
} catch (e) {