You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
External Packages Fail in Monorepos Due to Dependency Hoisting - Major DX Issue
Description
There's a significant issue when using Convex's externalPackages for node envs feature within monorepos. The current implementation doesn't account for monorepo package management, where dependencies are typically hoisted to the root. This affects ALL external packages, with Sharp being a prime example in my case.
Problem Scope
This is NOT just a Sharp-specific issue - it affects any external package used with Convex in a monorepo setup.
The externalPackages feature expects packages in the local node_modules, and since monorepos hoist the dependecies to the root, convex is unable to find them.
Current Behavior
When using ANY external package in a monorepo:
Dependencies are hoisted to root node_modules (standard monorepo behavior)
Convex can't locate the package even when it's in root package.json
Deployment fails due to missing dependencies
Adding to root package.json is insufficient - must also add to the Convex app's package.json
@IAlphaOmegaI thanks for submitting, sorry this slipped through the cracks for a month. If you have a paid Convex plan feel free to email support@convex.dev if you're blocked on something like this in the future.
What's your status with this currently, how's the workaround going?
There are several different ways monorepos can be set up, we use Rush which doesn't use a shared package.json at the root, but yeah the root style is more common.
Sounds like the convex CLI needs to implement the same package resolution behavior as Node.js, walking up directories to the first ancestor with a node_modules directory with this directory.
@IAlphaOmegaI thanks for submitting, sorry this slipped through the cracks for a month. If you have a paid Convex plan feel free to email support@convex.dev if you're blocked on something like this in the future.
What's your status with this currently, how's the workaround going?
There are several different ways monorepos can be set up, we use Rush which doesn't use a shared package.json at the root, but yeah the root style is more common.
Sounds like the convex CLI needs to implement the same package resolution behavior as Node.js, walking up directories to the first ancestor with a node_modules directory with this directory.
The workaround works great honestly, it's not that hard to maintain and it does the job well. Since I don't use a big number of external dependencies, it is not hard for me to cut and paste from monorepo node_modules to apps/provider (where my convex app is) node_modules.
External Packages Fail in Monorepos Due to Dependency Hoisting - Major DX Issue
Description
There's a significant issue when using Convex's
externalPackages
for node envs feature within monorepos. The current implementation doesn't account for monorepo package management, where dependencies are typically hoisted to the root. This affects ALL external packages, with Sharp being a prime example in my case.Problem Scope
This is NOT just a Sharp-specific issue - it affects any external package used with Convex in a monorepo setup.
The
externalPackages
feature expects packages in the localnode_modules
, and since monorepos hoist the dependecies to the root, convex is unable to find them.Current Behavior
When using ANY external package in a monorepo:
node_modules
(standard monorepo behavior)package.json
package.json
is insufficient - must also add to the Convex app'spackage.json
Example with Sharp
Current Workaround (Hacky)
node_modules
inside the Convex app directorypackage.json
externalPackage
Suggested Solutions
externalPackages
docsexternalPackages
feature to work with hoisted dependenciesEnvironment
The text was updated successfully, but these errors were encountered: