typescript-transform-paths icon indicating copy to clipboard operation
typescript-transform-paths copied to clipboard

Feature Request: Support non ts/tsx files like .css, .scss, .svg, .png, etc

Open siosphere opened this issue 1 year ago • 4 comments

We use static assets extensively, importing css modules, images, svgs, etc.

None of those paths are transformed with this library, even with modules being declared appropriately.

It would be nice if all imports would properly be transformed to relative

siosphere avatar Jun 07 '24 19:06 siosphere

Hey @siosphere, how are you transforming those other files? I am specifically interested in the css files, do you use some plugin for postcss?

dimitur2204 avatar Nov 28 '24 17:11 dimitur2204

@danielpza thanks for marking this as "good first issue", that gives me some confidence I could help implement this :) can you give any guidance on where to start for the implementation?

mfisher87 avatar Jun 03 '25 22:06 mfisher87

@danielpza thanks for marking this as "good first issue", that gives me some confidence I could help implement this :) can you give any guidance on where to start for the implementation?

Hey @mfisher87, I would suggest to start looking at the https://github.com/LeDDGroup/typescript-transform-paths/blob/master/src/utils/resolve-module-name.ts file.

TBH This is probably not the easiest issue to get started with, but I won't reject a good PR that fixes the issue and adds test coverage.

I would advice using another alternative that is better supported by typescript & other tools, like nodejs subpaths imports, or yarn link: protocol

Cheers.

danielpza avatar Jun 04 '25 00:06 danielpza

Thanks for the advice! Looking in to the options :)

mfisher87 avatar Jun 04 '25 00:06 mfisher87