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 > DynamicImportPathRewriteCustom

DynamicImportPathRewriteCustom interface

Rewrite dynamic import with a custom function

Signature:

export interface DynamicImportPathRewriteCustom 

Remarks

The function in the function should have the signature of:

(path: string, defaultImpl: (path: string) => Promise<unknown>) => Promise<unknown>

where the defaultImpl is the transformer’s default runtime helper.

The function must be an ArrowFunctionExpression on the syntax level.

Example

{
     type: 'custom',
     function: "(path, defaultImpl) => defaultImpl('std:' + path)"
}

Properties

Property Type Description
function string The function string. It must be an ArrowFunctionExpression.
type ‘custom’