0.2.3 • Published 1 year ago
@build-script/typescript-transformer-common v0.2.3
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
}
]
}
}
0.2.3
1 year ago
0.2.2
1 year ago
0.1.10
2 years ago
0.2.1
2 years ago
0.2.0
2 years ago
0.1.9
2 years ago
0.1.8
2 years ago
0.1.7
2 years ago
0.1.6
2 years ago
0.1.5
3 years ago
0.1.4
3 years ago
0.1.3
3 years ago
0.1.2
3 years ago
0.1.1
3 years ago
0.1.0
4 years ago
0.0.5
4 years ago
0.0.4
4 years ago
0.0.3
4 years ago
0.0.2
4 years ago
0.0.1
4 years ago