Skip to content

Conversation

@wxgisu
Copy link

@wxgisu wxgisu commented Jun 3, 2024

Problem:
When consuming the svelte-movealbe package in a pnpm monorepo, vite build and vite dev fails with error saying "Cannot find module framwork-utils". However, in an npm managed repo, builds are fine. This is because pnpm requires each package to correctly specify direct dependencies, where npm allow dependencies to be shared across packages.

E.g.

A -> B -> C
|         ↑
-----------

In this case, A and B both directly depend on C. For npm, if A declares C as a dependency, but B does not, it is fine. For pnpm, both A and B has to declare C as a dependency.

Root Cause:

  • The moveable package directly depend on framework-utils, but missing it as a dependency in its package.json file.
  • The svelte-moveable package directly depend on @daybrush/utils, but missing it as a dependency in its package.json file.

Solution:
Adding missing dependencies in corresponding package.json files, under dependencies field because they are labeled as external in the rollup.config.js file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant