-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Description
Description
importing from path alias doesn't work in the react native after upgrading to v69.
Version
0.69.3
Output of npx react-native info
System:
OS: macOS 12.5
CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
Memory: 40.48 MB / 8.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.14.0 - /usr/local/bin/node
Yarn: 1.22.19 - ~/.yarn/bin/yarn
npm: 8.3.1 - /usr/local/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK:
Android NDK: 22.1.7171670
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8193401
Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
Languages:
Java: 11.0.12 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.0.0 => 18.0.0
react-native: 0.69.3 => 0.69.3
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
After upgrading react native version from 66 to 69, I'm facing this issue:
TypeError: Cannot read property 'component' of undefined
This component has been imported from the path alias like this:
import { component } from "@components";
but if I change the import approach and do it like this: import { component } from "./src/{ path to the component }";
, the issue is gone.