Closed Andynopol closed 8 months ago
If you have a directory named as a library(ex: redux) tsc-alias replaces the import paths to the redux library with the ones to the local directory.
How to reproduce:
"baseUrl":"./" "paths":{ "@redux":["src/redux"], "@redux/*":["src/redux"] ... }
"build": "tsc && tsc-alias -p ./tsconfig.json"
Compile result:
declare const _default: import("redux").Reducer<TYPE>;
After tsc-alias:
declare const _default: import("../../../redux").Reducer<TYPE>;
In my case, I am trying to compile a react library I am working on.
Here is the tsconfig.json:
{ "compilerOptions": { "strict": true, "jsx": "react-jsx", "declaration": true, "esModuleInterop": true, "removeComments": true, "allowJs": true, "allowSyntheticDefaultImports": true, "outDir": "dist", "target": "ESNext", "module": "CommonJS", "moduleResolution": "node", "baseUrl": "./", "paths": { "@rdx": ["src/rdx"], "@rdx/": ["src/rdx/"], } }, "include": ["src/*/"], "exclude": ["packages/@interactjs/**", "example"] }
I replace redux with rdx, but still, this is not an expected result and may take time for someone to remark this.
redux
rdx
I'm running into the same situation. I'm using the npm module, redux, and it's replacing it with ../redux, which is also a folder that I have in my project structure.
../redux
https://github.com/justkey007/tsc-alias/discussions/110
If you have a directory named as a library(ex: redux) tsc-alias replaces the import paths to the redux library with the ones to the local directory.
How to reproduce:
"build": "tsc && tsc-alias -p ./tsconfig.json"
Compile result:
declare const _default: import("redux").Reducer<TYPE>;
After tsc-alias:
declare const _default: import("../../../redux").Reducer<TYPE>;
In my case, I am trying to compile a react library I am working on.
Here is the tsconfig.json:
{ "compilerOptions": { "strict": true, "jsx": "react-jsx", "declaration": true, "esModuleInterop": true, "removeComments": true, "allowJs": true, "allowSyntheticDefaultImports": true, "outDir": "dist", "target": "ESNext", "module": "CommonJS", "moduleResolution": "node", "baseUrl": "./", "paths": { "@rdx": ["src/rdx"], "@rdx/": ["src/rdx/"], } }, "include": ["src/*/"], "exclude": ["packages/@interactjs/**", "example"] }
I replace
redux
withrdx
, but still, this is not an expected result and may take time for someone to remark this.