Acknowledgement
Comment
When using rewriteRelativeImportExtensions, all relative imports with ts extensions are changed to js. This is fine for static imports but, since importing and running ts files is still possible in some environments, this may be problematic or worst, buggy, for functional imports, see this exemple :
// filePath is the path to a file that being listed at runtime and can have a ts extension
if (filePath.endsWith('.ts')) {
const file = await import(filePath);
// do something
}
import(filePath) will be unconditionally shimmed here, and it's not a desirable behavior because the shimming process clearly introduces a bug: a ts file will have his extension changed to js, and import() will throw or, even worst, open the js file if it exists (it may be or not the equivalent of the original file).
How to control and/or disable this behavior?
See #59767 for details about rewriteRelativeImportExtensions