viewstools / yarn-workspaces-cra-crna

How to use yarn workspaces with Create React App and Create React Native App (Expo) to share common code across
151 stars 23 forks source link

Doesn't support transitive workspace based dependencies #21

Closed allforabit closed 6 years ago

allforabit commented 6 years ago

I may be missing something but it doesn't seem to be working when there's multiple levels of dependencies between workspace modules. I.e. moduleA -> moduleB -> moduleC. ModuleA finds moduleB but moduleB can't find moduleC (where all modules are internal and located in packages folder). Is this a use case that is supported? The issue seems to be that moduleB will look for the package relative to moduleA rather than from the packages folder. Here's some output to illustrate better:

Unable to resolve ../../native/src/shared/domain/schema/widgets" from ".//.../packages/components/widgets/text.tsx`: The module `../../native/src/shared/domain/schema/widgets` could not be found"

native is the package where the crna app is located and where the app is started. The shared folder is setup with a package.json and named 'shared'. Here's the import statement:

import { TEXT } from "shared/domain/schema/widgets";
allforabit commented 6 years ago

My bad I had a babel module resolver plugin added to my bablerc that was causing the problem. It's working great now. Thanks for doing all the legwork on getting crna and yarn workspaces setup to play nicely together.