mirror of
https://github.com/LukeHagar/redocly-cli.git
synced 2025-12-06 04:21:09 +00:00
fix: resolve path correctly when importing plugin (#1705)
This commit is contained in:
5
.changeset/strange-gifts-clap.md
Normal file
5
.changeset/strange-gifts-clap.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@redocly/cli": patch
|
||||
---
|
||||
|
||||
Fixed the absolute path for importing plugins in Windows.
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user