From 05e4ceee5b8d1e838cc62a8f8901dbdbd1e6280b Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Wed, 1 Sep 2021 17:23:32 +0200 Subject: [PATCH] Ensure `purge.options.safelist` is taken into account (#5356) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also fixed a small typo 🤫 --- src/util/resolveConfig.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/util/resolveConfig.js b/src/util/resolveConfig.js index 46ab44026..17265125d 100644 --- a/src/util/resolveConfig.js +++ b/src/util/resolveConfig.js @@ -312,9 +312,11 @@ function normalizeConfig(config) { safelist: (() => { let { content, purge } = config - let [safelisKey, safelistPaths] = (() => { + let [safelistKey, safelistPaths] = (() => { if (Array.isArray(content?.safelist)) return ['content.safelist', content.safelist] if (Array.isArray(purge?.safelist)) return ['purge.safelist', purge.safelist] + if (Array.isArray(purge?.options?.safelist)) + return ['purge.options.safelist', purge.options.safelist] return [null, []] })() @@ -330,7 +332,7 @@ function normalizeConfig(config) { } throw new Error( - `Values inside '${safelisKey}' can only be of type 'string', found '${typeof content}'.` + `Values inside '${safelistKey}' can only be of type 'string', found '${typeof content}'.` ) }) })(),