Skip to content

Commit d6916ed

Browse files
committed
WIP
1 parent 50877a2 commit d6916ed

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/cli.js

+14-12
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,17 @@ function oneOf(...options) {
146146
)
147147
}
148148

149+
function loadPostcss() {
150+
// Try to load a local `postcss` version first
151+
try {
152+
if (!process.env.BUILT_IN_POSTCSS) {
153+
return require('postcss')
154+
}
155+
} catch {}
156+
157+
return lazyPostcss()
158+
}
159+
149160
let commands = {
150161
init: {
151162
run: init,
@@ -576,18 +587,8 @@ async function build() {
576587
})(),
577588
].filter(Boolean)
578589

579-
function loadPostcss() {
580-
// Try to load a local `postcss` version first
581-
try {
582-
if (!process.env.BUILT_IN_POSTCSS) {
583-
return require('postcss')
584-
}
585-
} catch {}
586-
587-
return lazyPostcss()
588-
}
589-
590-
let processor = loadPostcss()(plugins)
590+
let postcss = loadPostcss()
591+
let processor = postcss(plugins)
591592

592593
function processCSS(css) {
593594
let start = process.hrtime.bigint()
@@ -720,6 +721,7 @@ async function build() {
720721
let tailwindPluginIdx = plugins.indexOf('__TAILWIND_PLUGIN_POSITION__')
721722
let copy = plugins.slice()
722723
copy.splice(tailwindPluginIdx, 1, tailwindPlugin)
724+
let postcss = loadPostcss()
723725
let processor = postcss(copy)
724726

725727
function processCSS(css) {

0 commit comments

Comments
 (0)