@@ -629,6 +629,7 @@ function setupContext(configOrPath) {
629
629
630
630
let sourcePath = result . opts . from
631
631
let [ tailwindConfig , userConfigPath , tailwindConfigHash ] = getTailwindConfig ( configOrPath )
632
+ let isConfigFile = userConfigPath !== null
632
633
633
634
let contextDependencies = new Set ( )
634
635
@@ -646,27 +647,28 @@ function setupContext(configOrPath) {
646
647
}
647
648
}
648
649
649
- if ( userConfigPath !== null ) {
650
+ if ( isConfigFile ) {
650
651
contextDependencies . add ( userConfigPath )
651
652
}
652
653
653
- let contextDependenciesChanged =
654
- trackModified ( [ ...contextDependencies ] ) || userConfigPath === null
654
+ let contextDependenciesChanged = trackModified ( [ ...contextDependencies ] )
655
655
656
656
process . env . DEBUG && console . log ( 'Source path:' , sourcePath )
657
657
658
- // If this file already has a context in the cache and we don't need to
659
- // reset the context, return the cached context.
660
- if ( contextMap . has ( sourcePath ) && ! contextDependenciesChanged ) {
661
- return contextMap . get ( sourcePath )
662
- }
658
+ if ( ! contextDependenciesChanged ) {
659
+ // If this file already has a context in the cache and we don't need to
660
+ // reset the context, return the cached context.
661
+ if ( isConfigFile && contextMap . has ( sourcePath ) ) {
662
+ return contextMap . get ( sourcePath )
663
+ }
663
664
664
- // If the config file used already exists in the cache, return that.
665
- if ( ! contextDependenciesChanged && configContextMap . has ( tailwindConfigHash ) ) {
666
- let context = configContextMap . get ( tailwindConfigHash )
667
- contextSourcesMap . get ( context ) . add ( sourcePath )
668
- contextMap . set ( sourcePath , context )
669
- return context
665
+ // If the config used already exists in the cache, return that.
666
+ if ( configContextMap . has ( tailwindConfigHash ) ) {
667
+ let context = configContextMap . get ( tailwindConfigHash )
668
+ contextSourcesMap . get ( context ) . add ( sourcePath )
669
+ contextMap . set ( sourcePath , context )
670
+ return context
671
+ }
670
672
}
671
673
672
674
// If this source is in the context map, get the old context.
@@ -723,7 +725,7 @@ function setupContext(configOrPath) {
723
725
724
726
// ---
725
727
726
- if ( userConfigPath !== null ) {
728
+ if ( isConfigFile ) {
727
729
for ( let dependency of getModuleDependencies ( userConfigPath ) ) {
728
730
if ( dependency . file === userConfigPath ) {
729
731
continue
0 commit comments