@@ -38,10 +38,10 @@ use externals::ExternalsPresets;
3838use indexmap:: IndexMap ;
3939use rspack_core:: {
4040 AssetParserDataUrl , AssetParserDataUrlOptions , AssetParserOptions , BoxPlugin , ByDependency ,
41- CacheOptions , ChunkLoading , ChunkLoadingType , CleanOptions , Compiler , CompilerOptions , Context ,
42- CrossOriginLoading , CssAutoGeneratorOptions , CssAutoParserOptions , CssExportsConvention ,
43- CssGeneratorOptions , CssModuleGeneratorOptions , CssModuleParserOptions , CssParserOptions ,
44- DynamicImportMode , EntryDescription , EntryOptions , EntryRuntime , Environment ,
41+ CacheOptions , ChunkLoading , ChunkLoadingType , CleanOptions , Compiler , CompilerOptions ,
42+ CompilerPlatform , Context , CrossOriginLoading , CssAutoGeneratorOptions , CssAutoParserOptions ,
43+ CssExportsConvention , CssGeneratorOptions , CssModuleGeneratorOptions , CssModuleParserOptions ,
44+ CssParserOptions , DynamicImportMode , EntryDescription , EntryOptions , EntryRuntime , Environment ,
4545 ExperimentCacheOptions , Experiments , ExternalItem , ExternalType , Filename , GeneratorOptions ,
4646 GeneratorOptionsMap , JavascriptParserCommonjsExportsOption , JavascriptParserCommonjsOptions ,
4747 JavascriptParserOptions , JavascriptParserOrder , JavascriptParserUrl , JsonGeneratorOptions ,
@@ -448,6 +448,7 @@ impl CompilerBuilder {
448448 let mut builder_context = BuilderContext :: default ( ) ;
449449 let compiler_options = self . options_builder . build ( & mut builder_context) ?;
450450 let mut plugins = builder_context. take_plugins ( & compiler_options) ;
451+ let platform = builder_context. take_platform ( ) ;
451452 plugins. append ( & mut self . plugins ) ;
452453
453454 let input_filesystem = self . input_filesystem . take ( ) ;
@@ -465,6 +466,7 @@ impl CompilerBuilder {
465466 None ,
466467 None ,
467468 compiler_context,
469+ Arc :: new ( platform) ,
468470 ) )
469471 }
470472}
@@ -913,6 +915,7 @@ impl CompilerOptionsBuilder {
913915 vec![ "web" . to_string( ) ]
914916 } ) ;
915917 let target_properties = get_targets_properties ( & target, & context) ;
918+ builder_context. platform = CompilerPlatform :: from ( & target_properties) ;
916919
917920 let development = matches ! ( self . mode, Some ( Mode :: Development ) ) ;
918921 let production = matches ! ( self . mode, Some ( Mode :: Production ) | None ) ;
0 commit comments