facebook / metro

🚇 The JavaScript bundler for React Native
https://metrobundler.dev
MIT License
5.18k stars 614 forks source link

How to configure metro to hot reload when source in node_modules/mypackage change? #665

Open kopax-polyconseil opened 3 years ago

kopax-polyconseil commented 3 years ago

Do you want to request a feature or report a bug?

Help

What is the current behavior?

I can't hot reload what's in node_modules

What is the expected behavior?

I want to be able to change source in node_modules and get hot reload within my app

Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.

In a react native application, I am using the following metro.config.js to support symlink: https://github.com/react-native-community/cli/issues/1238#issue-673055870

Symlink works fine and I can see when I update the source Refreshing being displayed on my screen.

However, the source is still the old one, I must restart metro process and the application in order to really see the changes.

How can I configure metro to hot reload change from within my linked modules?

This is what I have in watchFolders metro option:

['/home/dka/.config/yarn/link/@pass-culture/id-check']

This is what I have when I run watchman watch-list:

watchman watch-list
{
    "version": "20210124.162314.0",
    "roots": [
        "/home/dka/workspace/github.com/pass-culture/id-check-front/packages/id-check",
        "/home/dka/workspace/github.com/pass-culture/pass-culture-app-native"
    ]
}

Thanks for helping

scott-harrison commented 1 year ago

Im having the same issue. Does anyone have a solution?

kopax-polyconseil commented 1 year ago

@scott-harrison we never solved it and stopped to use symlink because the dev environments was really bad without the hot reload.