ts-transformer-replace-paths
v1.0.1
Published
TypeScript custom transformer that replaces import paths with regular expressions
Downloads
10
Readme
ts-transformer-replace-paths
TypeScript custom transformer that replaces import paths with regular expressions
tsconfig.json
:
{
"compilerOptions": {
"plugins": [
{
"transform": "ts-transformer-replace-paths",
"replaceImportPaths": {
"^foo/esm/(.+)": "foo/cjs/$1",
"^bar$": "buzz"
}
}
]
}
}
Input:
import * as foo from 'foo/esm/index';
import { bar } from "bar";
import 'asd';
foo;
bar;
Output:
import * as foo from 'foo/cjs/index';
import { bar } from "buzz";
import 'asd';
foo;
bar;