diff --git a/.changeset/tender-forks-argue.md b/.changeset/tender-forks-argue.md new file mode 100644 index 0000000000..cd69afa4b2 --- /dev/null +++ b/.changeset/tender-forks-argue.md @@ -0,0 +1,7 @@ +--- +"@redocly/openapi-core": patch +"@redocly/cli": patch +--- + +Fixed an issue where running the `preview` command failed because one of its dependencies could not be resolved. +The issue occurred when Realm was not installed in the `node_modules` of the project. diff --git a/packages/core/src/config/config-resolvers.ts b/packages/core/src/config/config-resolvers.ts index ee51362532..922e89d602 100644 --- a/packages/core/src/config/config-resolvers.ts +++ b/packages/core/src/config/config-resolvers.ts @@ -136,7 +136,14 @@ export async function resolvePlugins( const absolutePluginPath = existsSync(maybeAbsolutePluginPath) ? maybeAbsolutePluginPath : // For plugins imported from packages specifically - require.resolve(plugin, { paths: [configDir] }); + require.resolve(plugin, { + paths: [ + // Plugins imported from the node_modules in the project directory + configDir, + // Plugins imported from the node_modules in the package install directory (for example, npx cache directory) + __dirname, + ], + }); if (!pluginsCache.has(absolutePluginPath)) { let requiredPlugin: ImportedPlugin | undefined;