diff --git a/crates/node_binding/binding.d.ts b/crates/node_binding/binding.d.ts index 31a5d915dcd1..1701083285a6 100644 --- a/crates/node_binding/binding.d.ts +++ b/crates/node_binding/binding.d.ts @@ -772,7 +772,7 @@ export interface RawCssAutoGeneratorOptions { exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" exportsOnly?: boolean localIdentName?: string - esModule: boolean + esModule?: boolean } export interface RawCssAutoParserOptions { @@ -793,14 +793,14 @@ export interface RawCssExtractPluginOption { export interface RawCssGeneratorOptions { exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" exportsOnly?: boolean - esModule: boolean + esModule?: boolean } export interface RawCssModuleGeneratorOptions { exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" exportsOnly?: boolean localIdentName?: string - esModule: boolean + esModule?: boolean } export interface RawCssModuleParserOptions { diff --git a/crates/rspack_binding_options/src/options/raw_module/mod.rs b/crates/rspack_binding_options/src/options/raw_module/mod.rs index 08bfdedf39da..b96b92eb1709 100644 --- a/crates/rspack_binding_options/src/options/raw_module/mod.rs +++ b/crates/rspack_binding_options/src/options/raw_module/mod.rs @@ -622,7 +622,7 @@ pub struct RawCssGeneratorOptions { #[napi(ts_type = r#""as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only""#)] pub exports_convention: Option, pub exports_only: Option, - pub es_module: bool, + pub es_module: Option, } impl From for CssGeneratorOptions { @@ -642,7 +642,7 @@ pub struct RawCssAutoGeneratorOptions { pub exports_convention: Option, pub exports_only: Option, pub local_ident_name: Option, - pub es_module: bool, + pub es_module: Option, } impl From for CssAutoGeneratorOptions { @@ -663,7 +663,7 @@ pub struct RawCssModuleGeneratorOptions { pub exports_convention: Option, pub exports_only: Option, pub local_ident_name: Option, - pub es_module: bool, + pub es_module: Option, } impl From for CssModuleGeneratorOptions { diff --git a/crates/rspack_core/src/options/module.rs b/crates/rspack_core/src/options/module.rs index f7709a31f048..042690a5ad8c 100644 --- a/crates/rspack_core/src/options/module.rs +++ b/crates/rspack_core/src/options/module.rs @@ -337,7 +337,7 @@ impl From for DataUrlEncoding { pub struct CssGeneratorOptions { pub exports_convention: Option, pub exports_only: Option, - pub es_module: bool, + pub es_module: Option, } #[derive(Debug, Clone, MergeFrom)] @@ -345,7 +345,7 @@ pub struct CssAutoGeneratorOptions { pub exports_convention: Option, pub exports_only: Option, pub local_ident_name: Option, - pub es_module: bool, + pub es_module: Option, } #[derive(Debug, Clone, MergeFrom)] @@ -353,7 +353,7 @@ pub struct CssModuleGeneratorOptions { pub exports_convention: Option, pub exports_only: Option, pub local_ident_name: Option, - pub es_module: bool, + pub es_module: Option, } #[derive(Debug, Clone, MergeFrom)] diff --git a/crates/rspack_plugin_css/src/plugin/impl_plugin_for_css_plugin.rs b/crates/rspack_plugin_css/src/plugin/impl_plugin_for_css_plugin.rs index ccf39fb286d6..975c3a973f3d 100644 --- a/crates/rspack_plugin_css/src/plugin/impl_plugin_for_css_plugin.rs +++ b/crates/rspack_plugin_css/src/plugin/impl_plugin_for_css_plugin.rs @@ -343,7 +343,7 @@ impl Plugin for CssPlugin { local_ident_name: None, exports_only: g.exports_only.expect("should have exports_only"), named_exports: p.named_exports.expect("should have named_exports"), - es_module: g.es_module, + es_module: g.es_module.expect("should have es_module"), }) as Box }), ); @@ -368,7 +368,7 @@ impl Plugin for CssPlugin { ), exports_only: g.exports_only.expect("should have exports_only"), named_exports: p.named_exports.expect("should have named_exports"), - es_module: g.es_module, + es_module: g.es_module.expect("should have es_module"), }) as Box }), ); @@ -393,7 +393,7 @@ impl Plugin for CssPlugin { ), exports_only: g.exports_only.expect("should have exports_only"), named_exports: p.named_exports.expect("should have named_exports"), - es_module: g.es_module, + es_module: g.es_module.expect("should have es_module"), }) as Box }), ); diff --git a/packages/rspack/src/config/adapter.ts b/packages/rspack/src/config/adapter.ts index 22738a02898a..6c2537364f1e 100644 --- a/packages/rspack/src/config/adapter.ts +++ b/packages/rspack/src/config/adapter.ts @@ -767,7 +767,7 @@ function getRawCssGeneratorOptions( return { exportsConvention: options.exportsConvention, exportsOnly: options.exportsOnly, - esModule: options.esModule! + esModule: options.esModule }; } @@ -778,7 +778,7 @@ function getRawCssAutoOrModuleGeneratorOptions( localIdentName: options.localIdentName, exportsConvention: options.exportsConvention, exportsOnly: options.exportsOnly, - esModule: options.esModule! + esModule: options.esModule }; }