Skip to content

How does the example project avoid importing the library without path? #287

@wwen0

Description

@wwen0

I created a library using create-react-native-library. When I was working on the example react native inside the library, I can import without including the path, i.e., I don't need "../my-library". I wonder is there some setup to do to avoid the path?

I created an independent react native app, and I put it next to the library. I followed "How does the library get linked to the example app in the generated project?" in FAQ to include the library in the react native app. This is because my library has a lot of native code. The problem I have is that if I don't use a path, for example: import { someFunction} from 'my-library', it will complain that it cannot find the module, although the app still runs fine. I found that if I import like this: import { someFunction} from '../..my-library', then error is gone, and the app still runs fine.

My question is how can I avoid the path, just like how this is achieved in the example app?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions