Skip to content
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

[0.57] Regression related to Yarn Workspaces #20969

Closed
3 tasks done
brunolemos opened this issue Sep 4, 2018 · 4 comments
Closed
3 tasks done

[0.57] Regression related to Yarn Workspaces #20969

brunolemos opened this issue Sep 4, 2018 · 4 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@brunolemos
Copy link
Contributor

brunolemos commented Sep 4, 2018

React Native Environment Info:
System:
OS: macOS 10.14
CPU: x64 Intel(R) Core(TM) i5-6267U CPU @ 2.90GHz
Memory: 43.02 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.11.3 - /usr/local/bin/node
Yarn: 1.9.4 - ~/.yarn/bin/yarn
npm: 5.6.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
Android SDK:
Build Tools: 23.0.1, 23.0.3, 24.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.0, 27.0.1, 27.0.2, 27.0.3, 28.0.0
API Levels: 19, 22, 23, 24, 25, 26, 27
IDEs:
Android Studio: 3.1 AI-173.4819257
Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
npmPackages:
@types/react: ^16.4.7 => 16.4.7
@types/react-native: ^0.56.10 => 0.56.10
react: 16.4.2 => 16.4.2
react-native: 0.57.0-rc.3 => 0.57.0-rc.3
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-macos-cli: 2.0.1

Description

When using [email protected], it looks for JS files on yarn workspaces just fine:

Looking for JS files in
   /Users/user/Projects/acme/projectA
   /Users/yser/Projects/acme/projectB 

When using [email protected], it doesn't see projectB:

Looking for JS files in
   /Users/user/Projects/acme/projectA

Loading dependency graph, done.
@brunolemos
Copy link
Contributor Author

brunolemos commented Sep 4, 2018

This was because the metro config file changed it's format and doesn't support getProjectRoots() {...} anymore on rn-cli.config.js. It changed to watchFolders: [...]. See changes below.

rn-cli.config.js

-const blacklist = require('metro/src/blacklist')
+const blacklist = require('metro-config/src/defaults/blacklist')

// ...

module.exports = {
+  watchFolders: alternateRoots,
-  getProjectRoots() {
-    return [
-      path.resolve(__dirname),
-    ].concat(alternateRoots)
-  },
}

@Titozzz
Copy link
Collaborator

Titozzz commented Sep 7, 2018

Thank, had the same issue, I'm gonna add it to the patch notes so that other people dont get lost

@Titozzz
Copy link
Collaborator

Titozzz commented Sep 7, 2018

@brunolemos Would you also know what happened to getBlacklistRE ?

Edit: Everything is in the doc, here:
https://facebook.github.io/metro/docs/en/configuration

const config = {
watchFolders: [path.join(__dirname, '../../')],
resolver: {
blacklistRE: /regex/,
},
};

module.exports = config;

@maitriyogin
Copy link

Hi,
just dropped into this after trying to upgrade to expo 31 ...
My rn-cli.js config looks like this :

const getConfig = require("metro-bundler-config-yarn-workspaces");
const config = getConfig(__dirname);
const blacklist = require("metro-config/src/defaults/blacklist");
const rnliConfig = {
  watchFolders: config.getProjectRoots(),
  resolver: {
    blacklistRE: blacklist
  }
};

When I start my app I get the following error :

[08:31:56] (node:96887) UnhandledPromiseRejectionWarning: Error: Cannot find module 'metro/src/blacklist'
[08:31:56]     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)

any ideas?

/Stephen

@facebook facebook locked as resolved and limited conversation to collaborators Sep 4, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Sep 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants