Import from path alias in RN 0.69
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.
Snack, code example, screenshot, or link to a repository
it is ok in RN 0.68 whitout any config ,link babelrc,tsconfig ?
I haven't tested it on 0.68. I upgraded from 0.66 to 0.69
I haven't tested it on 0.68. I upgraded from 0.66 to 0.69
0.69.5
I haven't tested it on 0.68. I upgraded from 0.66 to 0.69 my config link this https://github.com/expo/expo/issues/18846#issuecomment-1229123562 help me oneone please
I tested it on 0.68.3 and it was ok.
0.68.3 is old, newest version is 0.69.5
Just wanted to be sure that this bug only exists on 0.69 and above.
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.