@@ -532,6 +532,12 @@ impl Options {
532
532
}
533
533
} ) ;
534
534
535
+ // inline_script defaults to true, but it's case only if minify is enabled.
536
+ // This is because minifier API is compatible with Terser, and Terser
537
+ // defaults to true, while by default swc itself doesn't enable
538
+ // inline_script by default.
539
+ let codegen_inline_script = js_minify. as_ref ( ) . map_or ( false , |v| v. format . inline_script ) ;
540
+
535
541
let preamble = if !cfg. jsc . output . preamble . is_empty ( ) {
536
542
cfg. jsc . output . preamble
537
543
} else {
@@ -800,6 +806,7 @@ impl Options {
800
806
emit_assert_for_import_attributes : experimental
801
807
. emit_assert_for_import_attributes
802
808
. into_bool ( ) ,
809
+ codegen_inline_script,
803
810
emit_isolated_dts : experimental. emit_isolated_dts . into_bool ( ) ,
804
811
resolver,
805
812
} )
@@ -1110,6 +1117,7 @@ pub struct BuiltInput<P: Pass> {
1110
1117
1111
1118
pub output : JscOutputConfig ,
1112
1119
pub emit_assert_for_import_attributes : bool ,
1120
+ pub codegen_inline_script : bool ,
1113
1121
1114
1122
pub emit_isolated_dts : bool ,
1115
1123
pub resolver : Option < ( FileName , Arc < dyn ImportResolver > ) > ,
@@ -1142,6 +1150,7 @@ where
1142
1150
emit_source_map_columns : self . emit_source_map_columns ,
1143
1151
output : self . output ,
1144
1152
emit_assert_for_import_attributes : self . emit_assert_for_import_attributes ,
1153
+ codegen_inline_script : self . codegen_inline_script ,
1145
1154
emit_isolated_dts : self . emit_isolated_dts ,
1146
1155
resolver : self . resolver ,
1147
1156
}
0 commit comments