I am developing an npm library using Typescript as programming language. To develop it comfortably, I used the paths
option in tsconfig.json and module-alias
so that I would have been able to write imports such as import * from '@/utils'
. The problem is that these paths remain the same also in the transpiled js files. This should be good because module-alias
should work with these paths. The problem is that it does only when I use it locally, but when I install the library with npm and try to run it, it stops to work. How can I solve this?
Note: I found the problem, if I put the __moduleAliases
config in the package.json of the project using my library and use the path to my library's dist it works. Still I do not know how to solve this problem.