@@ -12,6 +12,7 @@ import {
1212 getSupportedBrowsers ,
1313 generateSearchDirectories ,
1414 findTailwindConfiguration ,
15+ loadPostcssConfiguration ,
1516} from '@angular/build/private' ;
1617
1718import { createCompilerPluginOptions } from './create-compiler-options' ;
@@ -202,22 +203,17 @@ async function runEsbuild(
202203 builderOptions . optimization
203204 ) ;
204205 const sourcemapOptions = normalizeSourceMaps ( builderOptions . sourceMap ) ;
206+
205207 const searchDirectories = await generateSearchDirectories ( [
206208 projectRoot ,
207209 workspaceRoot ,
208210 ] ) ;
209- const tailwindConfigurationPath =
210- findTailwindConfiguration ( searchDirectories ) ;
211-
212- const fullProjectRoot = path . join ( workspaceRoot , projectRoot ) ;
213- const resolver = createRequire ( fullProjectRoot + '/' ) ;
214-
215- const tailwindConfiguration = tailwindConfigurationPath
216- ? {
217- file : tailwindConfigurationPath ,
218- package : resolver . resolve ( 'tailwindcss' ) ,
219- }
220- : undefined ;
211+ const postcssConfiguration = await loadPostcssConfiguration (
212+ searchDirectories
213+ ) ;
214+ const tailwindConfiguration = postcssConfiguration
215+ ? undefined
216+ : await getTailwindConfig ( searchDirectories ) ;
221217
222218 const outputNames = {
223219 bundles : '[name]' ,
@@ -256,6 +252,7 @@ async function runEsbuild(
256252 inlineStyleLanguage : builderOptions . inlineStyleLanguage ,
257253 jit : false ,
258254 tailwindConfiguration,
255+ postcssConfiguration,
259256 } as any ,
260257 target ,
261258 undefined
@@ -303,7 +300,7 @@ async function runEsbuild(
303300 ...( ! dev ? { ngDevMode : 'false' } : { } ) ,
304301 ngJitMode : 'false' ,
305302 } ,
306- ...( builderOptions . loader ? { loader : builderOptions . loader } : { } ) ,
303+ ...( builderOptions . loader ? { loader : builderOptions . loader } : { } ) ,
307304 } ;
308305
309306 const ctx = await esbuild . context ( config ) ;
@@ -330,6 +327,22 @@ async function runEsbuild(
330327 return writtenFiles ;
331328}
332329
330+ async function getTailwindConfig (
331+ searchDirectories : { root : string ; files : Set < string > } [ ]
332+ ) : Promise < { file : string ; package : string } | undefined > {
333+ const tailwindConfigurationPath =
334+ findTailwindConfiguration ( searchDirectories ) ;
335+
336+ if ( ! tailwindConfigurationPath ) {
337+ return undefined ;
338+ }
339+
340+ return {
341+ file : tailwindConfigurationPath ,
342+ package : createRequire ( tailwindConfigurationPath ) . resolve ( 'tailwindcss' ) ,
343+ } ;
344+ }
345+
333346function createTsConfigForFederation (
334347 workspaceRoot : string ,
335348 tsConfigPath : string ,
0 commit comments