@@ -30,7 +30,7 @@ use swc_core::{
30
30
ecma:: {
31
31
ast:: { EsVersion , Program } ,
32
32
atoms:: Atom ,
33
- parser:: { Syntax , parse_file_as_module} ,
33
+ parser:: { EsSyntax , Syntax , parse_file_as_module} ,
34
34
transforms:: base:: resolver,
35
35
} ,
36
36
} ;
@@ -47,13 +47,13 @@ use crate::{
47
47
IdentCollector , InitFragment , InitFragmentStage , LibIdentOptions ,
48
48
MaybeDynamicTargetExportInfoHashKey , Module , ModuleArgument , ModuleGraph ,
49
49
ModuleGraphCacheArtifact , ModuleGraphConnection , ModuleIdentifier , ModuleLayer ,
50
- ModuleStaticCacheArtifact , ModuleType , NAMESPACE_OBJECT_EXPORT , PrefetchExportsInfoMode , Resolve ,
51
- RuntimeCondition , RuntimeGlobals , RuntimeSpec , SourceType , UsageState , UsedName , UsedNameItem ,
52
- define_es_module_flag_statement , escape_identifier , filter_runtime , get_runtime_key ,
53
- impl_source_map_config , merge_runtime_condition , merge_runtime_condition_non_false ,
54
- module_update_hash, property_access, property_name, reserved_names :: RESERVED_NAMES ,
55
- returning_function , runtime_condition_expression , subtract_runtime_condition ,
56
- to_identifier_with_escaped, to_normal_comment,
50
+ ModuleStaticCacheArtifact , ModuleType , NAMESPACE_OBJECT_EXPORT , ParserOptions ,
51
+ PrefetchExportsInfoMode , Resolve , RuntimeCondition , RuntimeGlobals , RuntimeSpec , SourceType ,
52
+ UsageState , UsedName , UsedNameItem , define_es_module_flag_statement , escape_identifier ,
53
+ filter_runtime , get_runtime_key , impl_source_map_config , merge_runtime_condition ,
54
+ merge_runtime_condition_non_false , module_update_hash, property_access, property_name,
55
+ reserved_names :: RESERVED_NAMES , returning_function , runtime_condition_expression ,
56
+ subtract_runtime_condition , to_identifier_with_escaped, to_normal_comment,
57
57
} ;
58
58
59
59
type ExportsDefinitionArgs = Vec < ( String , String ) > ;
@@ -1989,10 +1989,27 @@ impl ConcatenatedModule {
1989
1989
let comments = SwcComments :: default ( ) ;
1990
1990
let mut module_info = concatenation_scope. current_module ;
1991
1991
1992
+ let jsx = compilation
1993
+ . options
1994
+ . module
1995
+ . parser
1996
+ . as_ref ( )
1997
+ . and_then ( |p| {
1998
+ let options = p. get ( ModuleType :: JsEsm . as_str ( ) ) ;
1999
+ match options {
2000
+ Some ( ParserOptions :: JavascriptEsm ( js_options) ) => js_options. jsx ,
2001
+ _ => None ,
2002
+ }
2003
+ } )
2004
+ . unwrap_or ( false ) ;
2005
+
1992
2006
let mut errors = vec ! [ ] ;
1993
2007
let program = match parse_file_as_module (
1994
2008
& fm,
1995
- Syntax :: default ( ) ,
2009
+ Syntax :: Es ( EsSyntax {
2010
+ jsx,
2011
+ ..Default :: default ( )
2012
+ } ) ,
1996
2013
EsVersion :: EsNext ,
1997
2014
Some ( & comments) ,
1998
2015
& mut errors,
0 commit comments