Adding package.json to directory breaks imports (jsx)

Forgive me if i am asking something basic; but hours of googling, and combing docs have proved fruitless.

Am trying to implement Yarn workspaces. In the root directory of my project I have added the workspaces property to the json as such: {... "workspaces":[..., "applications/*", "applications/*/apps/*"]};
the applications and application/apps beign directories that contain packages to be.
I dont know that has any effect as adding this did not cause any issues with my project.

the entry point (index.jsx) contains an import of some dependencies that reside in another directory (a sibling to the applications directory called platform).
in the applications/my-app/index.jsx i have :
import {name-of-import} from 'platform/source/toexport'
This is working fine, as I said earlier… but adding a basic package.json file in the my-app directory:
package.json :

  "name": "my-app",
  "version": "1.0.0",

I started getting an error: ‘platform/source/toexport’ cannot be resolved…

removing the package.json fixes the error ( but then , of course workspaces cannot treat this as a module)

maybe this is a basic concept with workspaces, or maybe the package.json file is changing the reference point from which the app imports from the platform directory. But I just can find any documentation as to how to address this.

any insight would be greatly appreciated

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.