@@ -122,12 +122,19 @@ function getUseDefineForClassFields(compilerOptions: ts.CompilerOptions, target:
122
122
export function tsCompilerOptionsToSwcConfig ( options : ts . CompilerOptions , filename : string ) : Options {
123
123
const isJsx = filename . endsWith ( '.tsx' ) || filename . endsWith ( '.jsx' ) || Boolean ( options . jsx )
124
124
const target = options . target ?? ts . ScriptTarget . ES2018
125
+
126
+ const enableInlineSourceMap =
127
+ options . inlineSourceMap ??
128
+ ( typeof process . env . SWC_NODE_INLINE_SOURCE_MAP === 'string'
129
+ ? Boolean ( process . env . SWC_NODE_INLINE_SOURCE_MAP )
130
+ : undefined )
131
+
125
132
return {
126
133
module : toModule ( options . module ?? ts . ModuleKind . ES2015 ) ,
127
134
target : toTsTarget ( target ) ,
128
135
jsx : isJsx ,
129
136
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
130
- sourcemap : options . sourceMap || options . inlineSourceMap ? 'inline' : Boolean ( options . sourceMap ) ,
137
+ sourcemap : options . sourceMap || enableInlineSourceMap ? 'inline' : Boolean ( options . sourceMap ) ,
131
138
experimentalDecorators : options . experimentalDecorators ?? false ,
132
139
emitDecoratorMetadata : options . emitDecoratorMetadata ?? false ,
133
140
useDefineForClassFields : getUseDefineForClassFields ( options , target ) ,
@@ -155,7 +162,7 @@ export function tsCompilerOptionsToSwcConfig(options: ts.CompilerOptions, filena
155
162
ignoreDynamic : Boolean ( process . env . SWC_NODE_IGNORE_DYNAMIC ) ,
156
163
swc : {
157
164
sourceRoot : options . sourceRoot ,
158
- inputSourceMap : options . inlineSourceMap ,
165
+ inputSourceMap : enableInlineSourceMap ,
159
166
} ,
160
167
}
161
168
}
0 commit comments