swc-project / swc-node

Faster ts-node without typecheck
MIT License
1.69k stars 69 forks source link

fix(register): ensure TS compiler option to SWC config transformer respects inline source map option #726

Closed behroozk closed 5 days ago

behroozk commented 10 months ago

Currently, the swc-node/register package does not respect the inlineSourceMap option from tsconfig. When inlineSourceMap is set to true, swc/register does not generate inline source maps. The issue is within the tsCompilerOptionsToSwcConfig function, where it only sets sourcemap property on the return object to true if the TS config sourceMap property is true, regardless of the inlineSourceMap property.

Also, per TS Config documentation (https://www.typescriptlang.org/tsconfig#inlineSourceMap), inlineSourceMap and sourcemap are mutually exclusive, therefore, both cannot be set to true.

This PR addresses this issue by checking for both of these TS config properties separately.

CLAassistant commented 10 months ago

CLA assistant check
All committers have signed the CLA.

Brooooooklyn commented 9 months ago

@behroozk you need to update test snapshot as well