justkey007 / tsc-alias

Replace alias paths with relative paths after typescript compilation
MIT License
876 stars 63 forks source link

feat: custom extension for resolveFullPath and add regex for minified js #203

Closed axmad386 closed 9 months ago

axmad386 commented 10 months ago

Hi, this library is all I need. Using it with esbuild is great combo. But I miss something

First, when the target files is minified version (esbuild minify=true), then It will not replace anything. Because minified version is look like this

import"something";
import{X}from"something";

As you can see, there is no space after import and from statement. I add regex to cover this situation, please correct me is the regex can be simplified.

Second, when using resolveFullPath option, this library only search for .js extension. My project is full esm, it's using .mjs. So I create additional option to cover this, so It can be adjusted to search .mjs or .cjs. By default it will search .js. I don't know if it's the best way.

epicmau5time commented 4 months ago

Hi @justkey007. This says it was merged into master and the read me says that resolveFullExtension is available but it does not seem to be a part of the actual code. The last release shows september and this was merged in November but no release followed this merge.

https://www.npmjs.com/package/tsc-alias?activeTab=code (/tsc-alias/dist/interfaces.d.ts)