diff --git a/cli/plasmo/src/features/manifest-factory/base.ts b/cli/plasmo/src/features/manifest-factory/base.ts index 872df5dc2..abc2390f7 100644 --- a/cli/plasmo/src/features/manifest-factory/base.ts +++ b/cli/plasmo/src/features/manifest-factory/base.ts @@ -176,7 +176,9 @@ export abstract class PlasmoManifest { get dependencies() { ok(this.packageData) - return this.packageData.dependencies + // to support npm workspaces (mono repos) we need to fallback to + // peerDependencies because dependencies will never exist + return this.packageData.dependencies ?? this.packageData.peerDependencies } get devDependencies() { diff --git a/core/parcel-runtime/src/index.ts b/core/parcel-runtime/src/index.ts index 9e8a4437f..2f1c980b3 100644 --- a/core/parcel-runtime/src/index.ts +++ b/core/parcel-runtime/src/index.ts @@ -27,6 +27,7 @@ export default new Runtime({ .getConfigFrom<{ dependencies: Record devDependencies: Record + peerDependencies: Record }>( join(process.env.PLASMO_PROJECT_DIR, "lab"), // parcel only look up ["package.json"], @@ -36,7 +37,8 @@ export default new Runtime({ ) .then((cfg) => cfg?.contents) - const hasReact = !!pkg?.dependencies?.react || !!pkg?.devDependencies?.react + // npm workspaces mono repo's do not have dependencies or devDependencies (they are defined in a parent directory), fallback to peerDependencies + const hasReact = !!pkg?.dependencies?.react || !!pkg?.devDependencies?.react || !!pkg?.peerDependencies?.react return { hasReact