From 50e1bfd461bbb90e6351484cbfac2699f389e59a Mon Sep 17 00:00:00 2001 From: Alex Varchuk Date: Thu, 14 Aug 2025 14:45:44 +0200 Subject: [PATCH 1/2] fix: loadConfig function should work in browser --- packages/core/src/utils.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/core/src/utils.ts b/packages/core/src/utils.ts index 3e3f2a3ca1..796842b0f9 100644 --- a/packages/core/src/utils.ts +++ b/packages/core/src/utils.ts @@ -1,5 +1,4 @@ import * as fs from 'node:fs'; -import * as path from 'node:path'; import { minimatch } from 'minimatch'; import pluralizeOne from 'pluralize'; import { parseYaml } from './js-yaml/index.js'; @@ -212,10 +211,8 @@ export function isCustomRuleId(id: string) { } export function doesYamlFileExist(filePath: string): boolean { - return ( - (path.extname(filePath) === '.yaml' || path.extname(filePath) === '.yml') && - !!fs?.existsSync?.(filePath) - ); + const ext = filePath.substr(filePath.lastIndexOf('.')); + return (ext === '.yaml' || ext === '.yml') && !!fs?.existsSync?.(filePath); } export type Falsy = undefined | null | false | '' | 0; From 545c06f8aded99f4fb97eab7e79449bc92569cbe Mon Sep 17 00:00:00 2001 From: Alex Varchuk Date: Thu, 14 Aug 2025 14:51:48 +0200 Subject: [PATCH 2/2] chore: add changeset --- .changeset/popular-tomatoes-draw.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/popular-tomatoes-draw.md diff --git a/.changeset/popular-tomatoes-draw.md b/.changeset/popular-tomatoes-draw.md new file mode 100644 index 0000000000..20bbf8c99e --- /dev/null +++ b/.changeset/popular-tomatoes-draw.md @@ -0,0 +1,5 @@ +--- +"@redocly/openapi-core": patch +--- + +Improved browser compatibility for `loadConfig`.