From 154e09d422296e7df462b8281c61be07a02e2c20 Mon Sep 17 00:00:00 2001 From: Gerrit Birkeland Date: Sat, 22 Jun 2024 16:14:47 -0600 Subject: [PATCH] Fix JSONC configuration files --- CHANGELOG.md | 1 + src/lib/utils/options/readers/typedoc.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bdb56dc1b..f20170fe6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - Fixed relative link detection for markdown links containing code in their label, #2606. - Fixed an issue with packages mode where TypeDoc would use (much) more memory than required, #2607. - TypeDoc will no longer crash when asked to render highlighted code for an unsupported language, #2609. +- `.jsonc` configuration files are now properly read as JSONC, rather than being passed to `require`. ### Thanks! diff --git a/src/lib/utils/options/readers/typedoc.ts b/src/lib/utils/options/readers/typedoc.ts index 86e18876c..75b5faa6e 100644 --- a/src/lib/utils/options/readers/typedoc.ts +++ b/src/lib/utils/options/readers/typedoc.ts @@ -69,7 +69,7 @@ export class TypeDocReader implements OptionsReader { seen.add(file); let fileContent: any; - if (file.endsWith(".json")) { + if (file.endsWith(".json") || file.endsWith(".jsonc")) { const readResult = ts.readConfigFile(normalizePath(file), (path) => FS.readFileSync(path, "utf-8"), );