@@ -2,7 +2,6 @@ import { readFile, rm, rmdir } from 'node:fs/promises';
22import { dirname , join , posix , resolve } from 'node:path' ;
33import { fileURLToPath , pathToFileURL } from 'node:url' ;
44
5- import './wasm-fallback.mjs' ;
65import {
76 build as viteBuild ,
87 defaultClientConditions ,
@@ -138,6 +137,9 @@ export const createViteConfig = ({
138137 const root = resolve ( vite . root ?? process . cwd ( ) ) ;
139138 const conditions = server ? defaultServerConditions : defaultClientConditions ;
140139
140+ // Lightning CSS publishes no native bindings for these platforms
141+ const lightningcss = process . arch !== 'ppc64' && process . arch !== 's390x' ;
142+
141143 return {
142144 ...vite ,
143145
@@ -194,15 +196,21 @@ export const createViteConfig = ({
194196 } ,
195197
196198 // CSS imports, modules, URLs, splitting, and minification are all Vite
197- // responsibilities. Native Lightning CSS options remain configurable.
199+ // responsibilities. Lightning CSS transforms the CSS, with its options
200+ // configurable, on platforms that have its native bindings; elsewhere
201+ // Vite's PostCSS pipeline transforms it instead.
198202 css : {
199203 ...vite . css ,
200- transformer : 'lightningcss' ,
204+ transformer : lightningcss ? 'lightningcss' : 'postcss ',
201205 } ,
202206
203207 build : {
204208 ...vite . build ,
205209
210+ // Vite's only CSS minifier is Lightning CSS itself, so without its
211+ // bindings the CSS is left as PostCSS produced it.
212+ ...( lightningcss ? { } : { cssMinify : false } ) ,
213+
206214 // Both builds are complete Vite outputs. The server library goes to a
207215 // private directory; the client writes into the final site.
208216 outDir,
0 commit comments