Skip to content

Cannot import the library in a RN app using the "default" pathΒ #623

@mrAlmond

Description

@mrAlmond

Description

I've just created a test library using create-react-native-library, the example works correctly but if I import the library in an external RN project (an app) I cannot use the "default" import path:

import { multiply } from 'testlib'

but I have to add "src" ad the end to make it work:

import { multiply } from 'testlib/src'

This happens using the latest RN 0.75.2.
Is there a workaround for this?

Thank yuo.

Packages

  • create-react-native-library
  • react-native-builder-bob

Selected options

npx create-react-native-library@latest testlib

Link to repro

npx create-react-native-library@latest testlib

Environment

System:
OS: macOS 14.4.1
CPU: (11) arm64 Apple M3 Pro
Memory: 100.89 MB / 18.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.17.0
path: ~/.local/share/rtx/installs/node/18.17.0/bin/node
Yarn:
version: 3.6.1
path: ~/.local/share/rtx/installs/node/18.17.0/bin/yarn
npm:
version: 9.6.7
path: ~/.local/share/rtx/installs/node/18.17.0/bin/npm
Watchman: Not Found
Managers:
CocoaPods:
version: 1.15.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.5
- iOS 17.5
- macOS 14.5
- tvOS 17.5
- visionOS 1.2
- watchOS 10.5
Android SDK: Not Found
IDEs:
Android Studio: 2023.1 AI-231.9392.1.2311.11255304
Xcode:
version: 15.4/15F31d
path: /usr/bin/xcodebuild
Languages:
Java:
version: javac 17
path: /Users/user/.local/share/rtx/installs/java/oracle-17/bin/javac
Ruby:
version: 3.2.2
path: /Users/user/.local/share/rtx/installs/ruby/3.2.2/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.3.1
wanted: 18.3.1
react-native:
installed: 0.75.2
wanted: 0.75.2
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: false
newArchEnabled: false
iOS:
hermesEnabled: Not found
newArchEnabled: Not found

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions