Ensure purge.options.safelist is taken into account (#5356)

Also fixed a small typo 🤫
This commit is contained in:
Robin Malfait 2021-09-01 17:23:32 +02:00 committed by GitHub
parent 691ed02f63
commit 05e4ceee5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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}'.`
)
})
})(),