diff --git a/src/node/config.ts b/src/node/config.ts index 3eebc49a8e9aee..98c70b40ab23d9 100644 --- a/src/node/config.ts +++ b/src/node/config.ts @@ -6,10 +6,12 @@ type Result = ReturnType extends Promise ? T : never let cachedPostcssConfig: Result | null | undefined export async function loadPostcssConfig(root: string): Promise { + if (cachedPostcssConfig !== undefined) { + return cachedPostcssConfig + } try { - return ( - cachedPostcssConfig || (cachedPostcssConfig = await postcssrc({}, root)) - ) + const load = require('postcss-load-config') as typeof postcssrc + return (cachedPostcssConfig = await load({}, root)) } catch (e) { return (cachedPostcssConfig = null) }