@soul-codes-dev/ts-transform-static-resolve-path
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

A TypeScript path-transformer plugin that uses require.resolve() on the import/export paths, outputting fully-specified .js paths (including index.js that is omitted from the original path) so that ESM runtime is happy with these fully-specified paths.

Usage

This tool assumes you are using over-typescript tools such as ts-patch. This transformer is known to work with TypeScript 5.x and ts-patch 3.x.

Add the following plugin configuration:

// tsconfig.json
{
	"compilerOptions": {
		"module": "es2015",
		"plugins": [
			{
				"transform": "@soul-codes-dev/ts-transform-static-resolve-path",
				"after": true,
				"mapTsxToJs": true // optional, if not set, .tsx becomes .jsx.
			}
		]
	}
}

Credits

This is based on a fork of @zoltu/typescript-transformer-append-js-extension, but it has since embarked on a different endeavor.

Readme

Keywords

none

Package Sidebar

Install

npm i @soul-codes-dev/ts-transform-static-resolve-path

Weekly Downloads

12

Version

2.1.0

License

Unlicense

Unpacked Size

15.2 kB

Total Files

7

Last publish

Collaborators

  • soul-codes