react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Import from path alias in RN 0.69

Open AlirezaHadjar opened this issue 3 years ago • 3 comments

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

Screen Shot 2022-08-17 at 1 25 57 PM

AlirezaHadjar avatar Aug 17 '22 08:08 AlirezaHadjar

it is ok in RN 0.68 whitout any config ,link babelrc,tsconfig ?

Valar103769 avatar Aug 26 '22 08:08 Valar103769

I haven't tested it on 0.68. I upgraded from 0.66 to 0.69

AlirezaHadjar avatar Aug 26 '22 19:08 AlirezaHadjar

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

Valar103769 avatar Aug 27 '22 05:08 Valar103769

I tested it on 0.68.3 and it was ok.

AlirezaHadjar avatar Aug 31 '22 05:08 AlirezaHadjar

0.68.3 is old, newest version is 0.69.5

Valar103769 avatar Aug 31 '22 10:08 Valar103769

Just wanted to be sure that this bug only exists on 0.69 and above.

AlirezaHadjar avatar Aug 31 '22 10:08 AlirezaHadjar

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.

github-actions[bot] avatar Feb 27 '23 12:02 github-actions[bot]