@build-script/typescript-transformer-resolve-info
v0.1.11
Published
A TypeScript transformer for use with ttypescript that will save import/export information to json file.
Downloads
22
Readme
typescript-transformer-import-commonjs
It will convert things like
import { emptyDir } from 'fs-extra';
Into
import fs_extra_1 from 'fs-extra';
const { emptyDir } = fs_extra_1;
Only if:
- path is not relative
- package name directly defined in
dependencies
inpackage.json
- imported package's
package.json
does not have"type": "module"
- not imported with special extensions:
.cjs
or.mjs
or.json
Usage
tsconfig.json: all extra options is optional
{
"compilerOptions": {
"plugins": [
{
"transform": "@build-script/typescript-transformer-dual-package",
"specialExtensions": ["cjs", "mjs", "json", "wasm", "cjs.js"], // defaults to cjs,mjs,json
"ignore": ["some-module"], // do not change import of this package
"force": ["some-module"], // force change import even it's type is module
"package.json": "../package.json" // Current package's json file, defaults to find the nearest one
}
]
}
}