最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

typescript - pnpm monorepo not finding a workspace package - Stack Overflow

programmeradmin1浏览0评论

I have a pnpm monorepo I created with two apps and two packages. The apps cannot find a specific package in the workspace even thru it exists.

my pnpm-workspace.yaml file

packages:
  - 'apps/staff-apps/*'
  - 'apps/client-apps/*'
  - 'packages/*'

my two packages in the packages dir:

- common
- firedb

The common package simple example package I setup from an example to see if it could detect the package build it and export a usable function. It works and can be imported.

The firedb package is a helper package for a firestore database.

My apps are in a staff-apps and client-apps one in each for now and are both create react-router apps.

The file at ./apps/staff-apps/semester-app/services/firestore.server.ts is trying to import a function from firedb. The import statement will autocomplete but I get a typescript error saying it does not exist even when I see the folder package with my own eyes.

The semester-app package.json has it there:

"dependencies": {
    "@conform-to/react": "^1.2.2",
    "@conform-to/zod": "^1.2.2",
    "@food-mono/common": "workspace:*",
    "@food-mono/firedb": "workspace:*",
    "@radix-ui/react-dialog": "^1.1.4",
    "@radix-ui/react-separator": "^1.1.1",
    "@radix-ui/react-slot": "^1.1.1",
    "@radix-ui/react-tooltip": "^1.1.6",
    "@react-router/node": "^7.1.2",
    "@react-router/serve": "^7.1.2",
    "class-variance-authority": "^0.7.1",
...

It works for the common package but not the firedb one.

The monorepo is completely open source and is my attempt to make apps for local food-pantries to use to help distribute food. I can't manage the family and staff apps separately anymore because they get out of sync too quickly so a monorepo is the only way I can continue to donate my time to helping with app development.

Here is the github link for where I am at now:

I made the branch stackover to lock this in one configuration for review. Any help would be appreciated.

发布评论

评论列表(0)

  1. 暂无评论