@@ -627,6 +627,7 @@ function setupContext(configOrPath) {
627627
628628 let sourcePath = result . opts . from
629629 let [ tailwindConfig , userConfigPath , tailwindConfigHash ] = getTailwindConfig ( configOrPath )
630+ let isConfigFile = userConfigPath !== null
630631
631632 let contextDependencies = new Set ( )
632633
@@ -644,27 +645,28 @@ function setupContext(configOrPath) {
644645 }
645646 }
646647
647- if ( userConfigPath !== null ) {
648+ if ( isConfigFile ) {
648649 contextDependencies . add ( userConfigPath )
649650 }
650651
651- let contextDependenciesChanged =
652- trackModified ( [ ...contextDependencies ] ) || userConfigPath === null
652+ let contextDependenciesChanged = trackModified ( [ ...contextDependencies ] )
653653
654654 process . env . DEBUG && console . log ( 'Source path:' , sourcePath )
655655
656- // If this file already has a context in the cache and we don't need to
657- // reset the context, return the cached context.
658- if ( contextMap . has ( sourcePath ) && ! contextDependenciesChanged ) {
659- return contextMap . get ( sourcePath )
660- }
656+ if ( ! contextDependenciesChanged ) {
657+ // If this file already has a context in the cache and we don't need to
658+ // reset the context, return the cached context.
659+ if ( isConfigFile && contextMap . has ( sourcePath ) ) {
660+ return contextMap . get ( sourcePath )
661+ }
661662
662- // If the config file used already exists in the cache, return that.
663- if ( ! contextDependenciesChanged && configContextMap . has ( tailwindConfigHash ) ) {
664- let context = configContextMap . get ( tailwindConfigHash )
665- contextSourcesMap . get ( context ) . add ( sourcePath )
666- contextMap . set ( sourcePath , context )
667- return context
663+ // If the config used already exists in the cache, return that.
664+ if ( configContextMap . has ( tailwindConfigHash ) ) {
665+ let context = configContextMap . get ( tailwindConfigHash )
666+ contextSourcesMap . get ( context ) . add ( sourcePath )
667+ contextMap . set ( sourcePath , context )
668+ return context
669+ }
668670 }
669671
670672 // If this source is in the context map, get the old context.
@@ -721,7 +723,7 @@ function setupContext(configOrPath) {
721723
722724 // ---
723725
724- if ( userConfigPath !== null ) {
726+ if ( isConfigFile ) {
725727 for ( let dependency of getModuleDependencies ( userConfigPath ) ) {
726728 if ( dependency . file === userConfigPath ) {
727729 continue
0 commit comments