diff --git a/e2e/esbuild/src/esbuild.test.ts b/e2e/esbuild/src/esbuild.test.ts index 4686732bb9..56af4ccb93 100644 --- a/e2e/esbuild/src/esbuild.test.ts +++ b/e2e/esbuild/src/esbuild.test.ts @@ -156,6 +156,13 @@ describe('EsBuild Plugin', () => { // Bundle only child lib runCLI(`build ${parentLib} --third-party=false`); + expect( + readJson(`dist/libs/${parentLib}/package.json`).dependencies + ).toEqual({ + // Don't care about the versions, just that they exist + rambda: expect.any(String), + lodash: expect.any(String), + }); runResult = runCommand(`node dist/libs/${parentLib}/index.cjs`); expect(runResult).toMatch(/Hello world/); expect(runResult).toMatch(/Hello from child lib/); diff --git a/packages/esbuild/src/executors/esbuild/esbuild.impl.ts b/packages/esbuild/src/executors/esbuild/esbuild.impl.ts index 04ea6d6357..289731b1a4 100644 --- a/packages/esbuild/src/executors/esbuild/esbuild.impl.ts +++ b/packages/esbuild/src/executors/esbuild/esbuild.impl.ts @@ -87,6 +87,10 @@ export async function* esbuildExecutor( generateLockfile: true, outputFileExtensionForCjs: getOutExtension('cjs', options), excludeLibsInPackageJson: !options.thirdParty, + // TODO(jack): Remove the need to pass updateBuildableProjectDepsInPackageJson option when overrideDependencies or extraDependencies are passed. + // Add this back to fix a regression. + // See: https://github.com/nrwl/nx/issues/19773 + updateBuildableProjectDepsInPackageJson: externalDependencies.length > 0, }; // If we're bundling third-party packages, then any extra deps from external should be the only deps in package.json