A custom transformer that can be used with ttypescript to transform ts imports to browser style imports
Home > config > PluginConfigs > extName
Add ‘.js’ extension for local import path.
Signature:
extName?: string | boolean
false
: disable the transform
true
: same as “.js”
a string: set your extension name like “.mjs”, “.js” or “.ejs”
Source code:
Filename: extName-default.ts
import './local-file'
import '/local-file'
import 'http://remote/file'
Outputs:
Filename: extName-false.js
// CompilerOptions: {"module":"ESNext"}
// PluginConfig: {"extName":false}
import './local-file';
import '/local-file';
import 'http://remote/file';
Filename: extName-true.js
// CompilerOptions: {"module":"ESNext"}
// PluginConfig: {"extName":true}
import "./local-file.js";
import "/local-file.js";
import 'http://remote/file';
Filename: extName-string.js
// CompilerOptions: {"module":"ESNext"}
// PluginConfig: {"extName":".ts"}
import "./local-file.ts";
import "/local-file.ts";
import 'http://remote/file';