@@ -629,6 +629,7 @@ function setupContext(configOrPath) {
629629
630630 let sourcePath = result . opts . from
631631 let [ tailwindConfig , userConfigPath , tailwindConfigHash ] = getTailwindConfig ( configOrPath )
632+ let isConfigFile = userConfigPath !== null
632633
633634 let contextDependencies = new Set ( )
634635
@@ -646,27 +647,28 @@ function setupContext(configOrPath) {
646647 }
647648 }
648649
649- if ( userConfigPath !== null ) {
650+ if ( isConfigFile ) {
650651 contextDependencies . add ( userConfigPath )
651652 }
652653
653- let contextDependenciesChanged =
654- trackModified ( [ ...contextDependencies ] ) || userConfigPath === null
654+ let contextDependenciesChanged = trackModified ( [ ...contextDependencies ] )
655655
656656 process . env . DEBUG && console . log ( 'Source path:' , sourcePath )
657657
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+ }
663664
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+ }
670672 }
671673
672674 // If this source is in the context map, get the old context.
@@ -723,7 +725,7 @@ function setupContext(configOrPath) {
723725
724726 // ---
725727
726- if ( userConfigPath !== null ) {
728+ if ( isConfigFile ) {
727729 for ( let dependency of getModuleDependencies ( userConfigPath ) ) {
728730 if ( dependency . file === userConfigPath ) {
729731 continue
0 commit comments