-
Notifications
You must be signed in to change notification settings - Fork 626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I can't use a symlinked package #1029
Comments
Hi @CodeWhisperer - in a monorepo setup, Metro should be configured to watch your workspace root. You'll need to make sure that's added to watchFolders: [path.join(__dirname, '..', '..')] You also need to have symlinks enabled in your Metro config: resolver: {
unstable_enableSymlinks: true
} If that doesn't work, can you share your |
Hello @robhogan , thank you very much for your answer, as you comment, I forgot to add the configuration in My
I leave you the folder structure to add more information.
If you need more information or any proof, let me know. |
Hi @CodeWhisperer. Looks like the main issue there is that Also, if your project structure is Try this: const config = {
watchFolders: [path.resolve(__dirname, '..')],
resolver: {
unstable_enableSymlinks: true,
unstable_enablePackageExports: true,
},
}; |
Hi @robhogan , Now I have
And I'm getting this new error
I have checked my version of babel and they are these in the package.json:
With that configuration, you can run it without problem? could you try it? |
Interesting, I'm hitting this issue as well. @robhogan In my example, I would like to use
The symlinks are actually resolving correctly, however it appears with by adding this
It appears to be searching for I have tried setting the Any clue here? I can also open a new issue if that helps. I have also tried linking |
I figured out why this is happening. Since |
I ran into issues with symlinks in a monorepo when upgrading from 0.71.* to 0.72.*. This was working previously with
|
Description
Hello everyone, after the new update of react native with version 0.72, and support for Symlink, I wanted to create a small project to test these features, but when importing a package created with lerna for a monorepo, I can't import it and use it correctly.
React Native Version
0.72.1
Output of
npx react-native info
info Fetching system and libraries information...
System:
OS: Linux 5.19 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
Memory: 5.50 GB / 15.54 GB
Shell:
version: 5.1.16
path: /bin/bash
Binaries:
Node:
version: 18.16.1
path: ~/.nvm/versions/node/v18.16.1/bin/node
Yarn:
version: 1.22.19
path: /home/linuxbrew/.linuxbrew/bin/yarn
npm:
version: 9.5.1
path: ~/.nvm/versions/node/v18.16.1/bin/npm
Watchman:
version: 2022.06.20.00
path: /home/linuxbrew/.linuxbrew/bin/watchman
SDKs:
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Languages:
Java:
version: 11.0.19
path: /usr/bin/javac
Ruby:
version: 3.0.2
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.1
wanted: 0.72.1
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Steps to reproduce
First I create an empty folder
mkdir monorepo && cd monorepo
I create a react native app
npx react-native@latest init AwesomeProject
I start lerna
lerna init
I create new package with lerna
lerna create package1
I modify packages/package1/package.js with this code:
I run react native in RN project (still without adding the lerna package)
I install my lerna package
/monorepo/AwesomeProject$ npm install ../packages/package1
I check that it has been installed in package.json
I go to App.tsx and import the package:
import {CustomButton} from 'package1';
And I use it:
Snack, code example, screenshot, or link to a repository
App.spx full code:
Screen error:
The text was updated successfully, but these errors were encountered: