@@ -160,14 +160,17 @@ impl ModuleOptions {
160
160
// For React Client References, the CSS Module "facade" module lives in the parent (server)
161
161
// module context, but the facade's references should be transitioned to the client (and
162
162
// only then be processed with Webpack/PostCSS).
163
- let module_css_external_transform_condition = RuleCondition :: Any ( vec ! [
164
- // If module css, then only when (Inner or Analyze or Compose)
165
- // <=> (not (module css)) or (Inner or Analyzer or Compose)
166
- RuleCondition :: not( module_css_condition. clone( ) ) ,
163
+ //
164
+ // Note that this is not an exhaustive condition for PostCSS/Webpack, but excludes certain
165
+ // cases, so it should be added conjunctively together with the `module_css_condition` rule.
166
+ //
167
+ // If module css, then only when (Inner or Analyze or Compose)
168
+ // <=> (not (module css)) or (Inner or Analyzer or Compose)
169
+ let module_css_external_transform_conditions = vec ! [
167
170
RuleCondition :: ReferenceType ( ReferenceType :: Css ( CssReferenceSubType :: Inner ) ) ,
168
171
RuleCondition :: ReferenceType ( ReferenceType :: Css ( CssReferenceSubType :: Analyze ) ) ,
169
172
RuleCondition :: ReferenceType ( ReferenceType :: Css ( CssReferenceSubType :: Compose ) ) ,
170
- ] ) ;
173
+ ] ;
171
174
172
175
let mut ts_preprocess = vec ! [ ] ;
173
176
let mut ecma_preprocess = vec ! [ ] ;
@@ -502,15 +505,22 @@ impl ModuleOptions {
502
505
} ;
503
506
504
507
rules. push ( ModuleRule :: new (
505
- RuleCondition :: All ( vec ! [
508
+ RuleCondition :: Any ( vec ! [
506
509
RuleCondition :: All ( vec![
507
510
RuleCondition :: Any ( vec![
508
511
RuleCondition :: ResourcePathEndsWith ( ".css" . to_string( ) ) ,
509
512
RuleCondition :: ContentTypeStartsWith ( "text/css" . to_string( ) ) ,
510
513
] ) ,
511
514
RuleCondition :: not( module_css_condition. clone( ) ) ,
512
515
] ) ,
513
- module_css_external_transform_condition. clone( ) ,
516
+ RuleCondition :: All (
517
+ [
518
+ vec![ module_css_condition. clone( ) ] ,
519
+ // see comment on module_css_external_transform_conditions
520
+ module_css_external_transform_conditions. clone( ) ,
521
+ ]
522
+ . concat( ) ,
523
+ ) ,
514
524
] ) ,
515
525
vec ! [ ModuleRuleEffect :: SourceTransforms ( ResolvedVc :: cell( vec![
516
526
ResolvedVc :: upcast(
@@ -693,7 +703,14 @@ impl ModuleOptions {
693
703
RuleCondition :: ResourceBasePathGlob ( Glob :: new( key. clone( ) ) . await ?)
694
704
} ,
695
705
RuleCondition :: not( RuleCondition :: ResourceIsVirtualSource ) ,
696
- module_css_external_transform_condition. clone( ) ,
706
+ // see comment on module_css_external_transform_conditions
707
+ RuleCondition :: Any (
708
+ [
709
+ vec![ RuleCondition :: not( module_css_condition. clone( ) ) ] ,
710
+ module_css_external_transform_conditions. clone( ) ,
711
+ ]
712
+ . concat( ) ,
713
+ ) ,
697
714
] ) ,
698
715
vec ! [ ModuleRuleEffect :: SourceTransforms ( ResolvedVc :: cell( vec![
699
716
ResolvedVc :: upcast(
0 commit comments