Skip to content

unstable_enableSymlinks does not seems to work #1142

Description

@clauderobi

Description

I have this project structure

projectRoot
-> node_modules/
-> src/
...
-> neWeb/ <- The intention is for this directory to be a symlink

I am getting this error message
Unable to resolve module ./neWeb/hello.js

However, if I replace the symlink with a real directory, the error goes away

I did a quick search on the https://reactnative.dev with the unstable_enableSymlinks key word but only found the announcement. Hopefully, the intent of the feature is similar to my use case.

React Native Version

0.72.7

Output of npx react-native info

info Fetching system and libraries information...
System:
OS: Linux 6.2 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
Memory: 3.79 GB / 46.94 GB
Shell:
version: 5.1.16
path: /bin/bash
Binaries:
Node:
version: 16.13.0
path: ~/.nvm/versions/node/v16.13.0/bin/node
Yarn: Not Found
npm:
version: 8.1.0
path: ~/.nvm/versions/node/v16.13.0/bin/npm
Watchman:
version: 20231001.212519.0
path: /usr/local/bin/watchman
SDKs:
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Languages:
Java:
version: 11.0.20.1
path: /usr/bin/javac
Ruby: Not Found
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.7
wanted: 0.72.7
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: Not found
newArchEnabled: Not found

Steps to reproduce

1 - Init a standard project
2 - Configure metro.config.js with unstable_enableSymlinks, as in the following
const config = { resolver: { unstable_enableSymlinks: true, }, };
3 - Add the required import
4 - npm start -- --reset-cache
5 - Type a to run on Android

Snack, screenshot, or link to a repository

The imported file is hello.js and simply have the following code.

export function dummy () {
  let result = 'Hello';

  return result;
}

And the default App.ts was modified to have

import { dummy } from './neWeb/hello.js';
debugger;
const a = dummy();
console.log(a);
debugger;

Github repo with the defect.
https://github.com/clauderobi/rn_Symlink

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions