akveo / react-native-ui-kitten

:boom: React Native UI Library based on Eva Design System :new_moon_with_face::sparkles:Dark Mode
https://akveo.github.io/react-native-ui-kitten/
MIT License
10.19k stars 952 forks source link

Can't find generated.json in an expo monorepo #1761

Open mikealche opened 12 months ago

mikealche commented 12 months ago

🐛 Bug Report

I'm going through the performance improvement docs while using ui-kitten in an expo app which is inside a monorepo (not sure this is relevant).

I don't have any custom mapping. Only a custom theme.

After modifying the metro.config.js file and running expo start -c I see the following error:

ENOENT: no such file or directory, open 'node_modules/@eva-design/eva/generated.json'

In fact, when I manually inspect that directory, there's no generated.json.

To Reproduce

Set up an expo monorepo with the official docs. Then have your metro.config.js be

/* eslint-disable @typescript-eslint/no-var-requires */
// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require('expo/metro-config');
const path = require('path');

const MetroConfig = require('@ui-kitten/metro-config');
const evaConfig = {
  evaPackage: '@eva-design/eva',
  // Optional, but may be useful when using mapping customization feature.
  // customMappingPath: './custom-mapping.json',
};

module.exports = async () => {
  // Find the workspace root, this can be replaced with `find-yarn-workspace-root`
  const workspaceRoot = path.resolve(__dirname, '../..');
  const projectRoot = __dirname;

  const config = getDefaultConfig(projectRoot);

  // 1. Watch all files within the monorepo
  config.watchFolders = [workspaceRoot];
  // 2. Let Metro know where to resolve packages, and in what order
  config.resolver.nodeModulesPaths = [
    path.resolve(projectRoot, 'node_modules'),
    path.resolve(workspaceRoot, 'node_modules'),
  ];

  // 3. Force Metro to resolve (sub)dependencies only from the `nodeModulesPaths`
  config.resolver.disableHierarchicalLookup = true;

  return MetroConfig.create(evaConfig, config);
};

Expected behavior

The command should work as expected

UI Kitten and Eva version

Package Version
@eva-design/eva ^2.2.0
@ui-kitten/components ^5.1.1

Environment information

  System:
    OS: macOS 13.0
    CPU: (10) arm64 Apple M1 Pro
  Binaries:
    Node: 16.18.0 - ~/.nvm/versions/node/v16.18.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v16.18.0/bin/yarn
    npm: 8.19.2 - ~/.nvm/versions/node/v16.18.0/bin/npm
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1
    Android SDK:
      API Levels: 32, 33
      Build Tools: 30.0.3, 33.0.0
      System Images: android-30 | Google Play ARM 64 v8a, android-33 | Google APIs ARM 64 v8a
  IDEs:
    Android Studio: 2021.3 AI-213.7172.25.2113.9123335
    Xcode: 14.1/14B47b - /usr/bin/xcodebuild
evansendra commented 8 months ago

@mikealche did you ever find anything facing the same issue now