TS Path aliases not resolving in published npm package #325
Labels
solution: duplicate
This issue or pull request already exists
solution: workaround available
There is a workaround available for this issue
topic: TS Paths Aliases
Related to using aliases with TypeScript paths
Current Behavior
Paths defined in tsconfig does not resolve in compiled npm package.
Expected behavior
"paths": {
"": ["src/", "node_modules/"],
"": ["@foo/", "src/foo/"],
Module not found: Can't resolve '@foo/components/ActionLink' in '/Users/sreekumarmenon/projects/xxxx/src/yyy/node_modules/xzzz.ui.core/dist'
Suggested solution(s)
Am I missing something? do I need to create a .babelrc file or add something in package.json?
I tried creating .babelrc, but that did not help
{
"plugins": [
[
"module-resolver",
{
"root": ["./src"],
"alias": {
"@rs-core/": "./src",
"@rs-components/": "./src/components",
"@rs-lib/*": "./src/lib"
},
"extensions": [".js", ".ts", ".tsx"]
}
]
]
}
Your environment
The text was updated successfully, but these errors were encountered: