Skip to content

The best way to use this module fixing "@" and "deep" issue #25

@Yehonal

Description

@Yehonal

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions