Skip to content

Commit

Permalink
fix(compartment-mapper): Development condition only implies devDepend…
Browse files Browse the repository at this point in the history
…encies for entry package
  • Loading branch information
kriskowal committed Nov 20, 2024
1 parent ec1380a commit 1024859
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/compartment-mapper/src/node-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ const graphPackage = async (
for (const name of Object.keys(optionalDependencies)) {
optionals.add(name);
}
if (dev !== undefined && dev !== null ? dev : conditions.has('development')) {
if (dev) {
assign(allDependencies, devDependencies);
}

Expand Down Expand Up @@ -863,17 +863,22 @@ export const compartmentMapForNodeModules = async (
moduleSpecifier,
options = {},
) => {
const { dev = undefined, commonDependencies = {}, policy } = options;
const { dev = false, commonDependencies = {}, policy } = options;
const { maybeRead, canonical } = unpackReadPowers(readPowers);
const languageOptions = makeLanguageOptions(options);

// dev is only set for the entry package, and implied by the development
// condition.
// The dev option is deprecated in favor of using conditions, since that
// covers more intentional behaviors of the development mode.

const graph = await graphPackages(
maybeRead,
canonical,
packageLocation,
conditions,
packageDescriptor,
dev,
dev || (conditions && conditions.has('development')),
commonDependencies,
languageOptions,
);
Expand Down

0 comments on commit 1024859

Please sign in to comment.