Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TS Path aliases not resolving in published npm package #325

Closed
msreekm opened this issue Nov 13, 2019 · 2 comments
Closed

TS Path aliases not resolving in published npm package #325

msreekm opened this issue Nov 13, 2019 · 2 comments
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

Comments

@msreekm
Copy link

msreekm commented Nov 13, 2019

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

Software Version(s)
TSDX ^0.11.0
TypeScript ^3.6.4
npm 6.4.1
Node v10.15.0
Operating System Mac
@swyxio
Copy link
Collaborator

swyxio commented Dec 4, 2019

thanks for filling, think this is a duplicate of #336

@swyxio swyxio closed this as completed Dec 4, 2019
@agilgur5 agilgur5 added the solution: duplicate This issue or pull request already exists label Mar 10, 2020
@agilgur5 agilgur5 changed the title Typescript Path not resolving in published npm package TS Path aliases not resolving in published npm package Mar 10, 2020
@agilgur5
Copy link
Collaborator

agilgur5 commented Mar 10, 2020

Actually more of a duplicate of #425 , which is kind of a duplicate of #175 .

But afaik, TS Path aliases are only for development usage (use by yourself when creating), not production usage (use by external consumers). Using it for both would be interesting but I'm not sure if that makes sense given that those two are independent use cases and might not reflect each other.

EDIT: re-reading this later, sounds like this is just for development usage, OP was just naming various pieces as if they were separate packages, but publishing as one(??) or something.

Indeed a duplicate of #336 which itself duplicates #91

@agilgur5 agilgur5 added topic: multi-entry Related to multi-entry support topic: TS Paths Aliases Related to using aliases with TypeScript paths labels Mar 10, 2020
@agilgur5 agilgur5 removed the topic: multi-entry Related to multi-entry support label May 3, 2020
@agilgur5 agilgur5 added the solution: workaround available There is a workaround available for this issue label Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

3 participants