Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit bf28258

Browse files
committed
Use fake postcss instead when it's plugins is empty
1 parent 5b4031e commit bf28258

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

server/css.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,8 @@ export class CSSProcessor {
9898
}
9999

100100
async function initPostCSS(plugins: PostCSSPlugin[]) {
101-
const { default: PostCSS } = await import(`https://esm.sh/postcss@${postcssVersion}`)
102101
const isDev = Deno.env.get('ALEPH_BUILD_MODE') === 'development'
103-
return PostCSS(await Promise.all(plugins.filter(p => {
102+
const pluginObjects = await Promise.all(plugins.filter(p => {
104103
if (isDev) {
105104
if (util.isNEString(p) && productionOnlyPostcssPlugins.includes(p)) {
106105
return false
@@ -121,7 +120,20 @@ async function initPostCSS(plugins: PostCSSPlugin[]) {
121120
} else {
122121
return p
123122
}
124-
})))
123+
}))
124+
125+
if (pluginObjects.length === 0) {
126+
return {
127+
process: (content: string) => ({
128+
async: async () => {
129+
return { content }
130+
}
131+
})
132+
}
133+
}
134+
135+
const { default: PostCSS } = await import(`https://esm.sh/postcss@${postcssVersion}`)
136+
return PostCSS(pluginObjects)
125137
}
126138

127139
async function importPostcssPluginByName(name: string) {

0 commit comments

Comments
 (0)