0.0.15 • Published 2 years ago

@build-script/typescript-transformer-static-resolve v0.0.15

Weekly downloads
7
License
MIT
Repository
github
Last release
2 years ago

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:

  1. path is not relative
  2. package name directly defined in dependencies in package.json
  3. imported package's package.json does not have "type": "module"
  4. 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.0.14

2 years ago

0.0.15

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

4 years ago

0.0.6

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