Skip to content

Error message 'Cannot find module' can be better #2

@ibezkrovnyi

Description

@ibezkrovnyi

I'm using monorepo (no lerana, with our own scripts, doesn't matter) with 9 TypeScript projects at work.
So, I'm super excited to see "references" feature.

I was playing around with this test learn-a project, and finally was able to make it working.
Here is an developer experience issue I found:

  1. Just after git clone and npm install, I see:
    image
    Somehow typescript depends on /packages/pkg2/node_modules/@ryancavanaugh/pkg1 even if /packages/pkg1 exists. It is somehow counterintuitive, at least error Cannot find module '@ryancavanaugh/pkg1' can be more descriptive.

  2. Just after npm install inside each /package/pkg1, /package/pkg2, /package/pkg3, I see:
    image
    It is a bit surprising, because now I have both pkg1 and pkg2 inside /packages/pkg3/node_modules/@ryancavanaugh:
    image
    After digging I found that pkg2@3.0.2 on npm has wrong "main" property in the package.json:

{
  "main": "index.js",
}

Should be:

{
  "main": "lib/index.js",
}

Again, error tells nothing about 'main' property of package.json.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions