Copied package contents into own repo to modify, does not compile

Short explanation:
I am using unimodules and modifying expo-camera code. When I copy the package files to my own repo and use that in my package.json, dependencies seem to be ignored and yarn install won’t work correctly. I can modify the local files in node_modules/expo-camera native code to work, but if I try to use the exact same files in my own remote repo in place of expo-camera, it crashes.

Long explanation:
I modified the native code for expo camera to do some extra things. When I modify objective c and java files inside of the installed node module folder (node_module/expo-camera) I can see my changes on iOS and Android builds with no problem. Of course, this isn’t really a long-term solution because those changes are only local.

I wanted to simply copy the package code in the Camera Package Repo and put it into a private repo to mess with, and then once I know what I want go through the process of creating a PR against the main repo if the feature works out.

The problem:

Once I say in my package.json to pull the identical files from my own repo, I get the following errors:

 expo-module prepare
Tried to guess the docs homepage for expo-camera; add it under the "homepage" entry in package.json
expo-module-scripts: README.md exists, not updating
src/Camera.tsx:1:47 - error TS2307: Cannot find module '@unimodules/core' or its corresponding type declarations.
1 import { Platform, UnavailabilityError } from '@unimodules/core';
                                                ~~~~~~~~~~~~~~~~~~
src/Camera.tsx:3:24 - error TS2307: Cannot find module 'react' or its corresponding type declarations.

3 import * as React from 'react';
                         ~~~~~~~

src/Camera.tsx:4:32 - error TS2307: Cannot find module 'react-native' or its corresponding type declarations.

4 import { findNodeHandle } from 'react-native';
                                 ~~~~~~~~~~~~~~

src/Camera.tsx:68:9 - error TS2304: Cannot find name '__DEV__'.

68     if (__DEV__) {
           ~~~~~~~

src/Camera.tsx:230:14 - error TS2339: Property 'props' does not exist on type 'Camera'.

230     if (this.props.onCameraReady) {

Basically, the downloaded files can’t find any of their dependencies.

Is there a way to do what I’m trying to do - which is, copy only the camera-files, edit them, host them in my repo, and then use that as the source for expo-camera?

1 Like