Skip to content

How do I use module aliases within a package? #494

Closed Answered by satya164
chriscoomber asked this question in Q&A
Discussion options

You must be logged in to vote

It's not that simple. Since you're publishing a library, first you need to make sure that generated TypeScript definitions rewrite the imports - which TypeScript doesn't support. So you'll need to use some third party tool like ts-patch or something else to build your definitions achieve that.

Then you need to configure babel plugin module resolver both in the example app, and in the library - and make sure bob uses that as well using the configFile option.

In addition you need to remove the react-native entry from your package.json as it points to the source code, but consumers can't use that because it contains aliases.

If you are linting your code, you may also need to configure ESLint…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by chriscoomber
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants