justkey007 / tsc-alias

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

Replacements for paths with extension fail to get replaced #175

Closed mcrider closed 1 year ago

mcrider commented 1 year ago

I'm importing files with a .css.ts extension (Vanilla Extract styles) using an alias. I'm finding that tsc-alias isn't replacing these aliases with a relative path, as its failing the valid path check. I've tried adding the resolveFullPaths: true configuration but I'm not 100% sure what that does and it doesn't seem to help. Is there anything else that I might need to configure? Input:

import Component from "@ui/components/ComponentFolder";
import { Styles } from "@ui/shared-styles/text.css";

Output:

import Component from "../../../src/components/ComponentFolder";
import { Styles } from "@ui/shared-styles/text.css";
mcrider commented 1 year ago

I'm going to close this, the issue went away when I change my outDir to build my files to dist rather than the root folder of the package. Its still concerning that that was the problem but its no longer an issue for us and at least there's a solution for people that have the same problem.