You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But I've noticed that link-module-alias uses more or less the same approach and I managed to find a proper way to use it in every cases.
First of all stop to create tons of useless aliases, do it in the right way and create an alias that has exactly the same name of your package. In this way if you are using your package as a "final application" or as a dependency, the paths will be kept in both cases.
Second, do not use the "postinstall" script but the "prepare" script in this way: "prepare": "npx link-module-alias"
It will create the link only when you're running npm install inside the package folder (so won't do anything when your package is included as a dependency).
When your package is a dependency nodejs will resolve the paths automatically without the need of a symlink.
PLUS: if you still have issues with intellisense on your vscode, consider to add the "paths" option inside tsconfig.json that will point to your root directory.
I'm trying it in production and everything works fine
The text was updated successfully, but these errors were encountered:
First of all stop to create tons of useless aliases, do it in the right way and create an alias that has exactly the same name of your package. In this way if you are using your package as a "final application" or as a dependency, the paths will be kept in both cases.
This is very opinionated and I find myself giving aliases to folders I want to hide their long path, going with "same structure" is very limiting.
Before using this package I was reading this article: https://gist.github.com/branneman/8048520 and then I came up with my "npm link solution": https://gist.github.com/branneman/8048520#gistcomment-3346781
But I've noticed that link-module-alias uses more or less the same approach and I managed to find a proper way to use it in every cases.
First of all stop to create tons of useless aliases, do it in the right way and create an alias that has exactly the same name of your package. In this way if you are using your package as a "final application" or as a dependency, the paths will be kept in both cases.
Second, do not use the "postinstall" script but the "prepare" script in this way:
"prepare": "npx link-module-alias"
It will create the link only when you're running
npm install
inside the package folder (so won't do anything when your package is included as a dependency).When your package is a dependency nodejs will resolve the paths automatically without the need of a symlink.
PLUS: if you still have issues with intellisense on your vscode, consider to add the "paths" option inside tsconfig.json that will point to your root directory.
I'm trying it in production and everything works fine
The text was updated successfully, but these errors were encountered: