ttypescript-browser-like-import-transformer

A custom transformer that can be used with ttypescript to transform ts imports to browser style imports


Project maintained by Jack-Works Hosted on GitHub Pages — Theme by mattgraham

Home > config > PluginConfigs > extName

PluginConfigs.extName property

Add ‘.js’ extension for local import path.

Signature:

extName?: string | boolean

Remarks

Example

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';