@@ -627,6 +627,7 @@ function setupContext(configOrPath) {
627
627
628
628
let sourcePath = result . opts . from
629
629
let [ tailwindConfig , userConfigPath , tailwindConfigHash ] = getTailwindConfig ( configOrPath )
630
+ let isConfigFile = userConfigPath !== null
630
631
631
632
let contextDependencies = new Set ( )
632
633
@@ -644,27 +645,28 @@ function setupContext(configOrPath) {
644
645
}
645
646
}
646
647
647
- if ( userConfigPath !== null ) {
648
+ if ( isConfigFile ) {
648
649
contextDependencies . add ( userConfigPath )
649
650
}
650
651
651
- let contextDependenciesChanged =
652
- trackModified ( [ ...contextDependencies ] ) || userConfigPath === null
652
+ let contextDependenciesChanged = trackModified ( [ ...contextDependencies ] )
653
653
654
654
process . env . DEBUG && console . log ( 'Source path:' , sourcePath )
655
655
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
+ }
661
662
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
+ }
668
670
}
669
671
670
672
// If this source is in the context map, get the old context.
@@ -721,7 +723,7 @@ function setupContext(configOrPath) {
721
723
722
724
// ---
723
725
724
- if ( userConfigPath !== null ) {
726
+ if ( isConfigFile ) {
725
727
for ( let dependency of getModuleDependencies ( userConfigPath ) ) {
726
728
if ( dependency . file === userConfigPath ) {
727
729
continue
0 commit comments