diff --git a/packages/esbuild/src/executors/esbuild/lib/build-esbuild-options.ts b/packages/esbuild/src/executors/esbuild/lib/build-esbuild-options.ts index 0b3081f687a62..e5a3c1b48cb15 100644 --- a/packages/esbuild/src/executors/esbuild/lib/build-esbuild-options.ts +++ b/packages/esbuild/src/executors/esbuild/lib/build-esbuild-options.ts @@ -40,10 +40,12 @@ export function buildEsbuildOptions( esbuildOptions.define = getClientEnvironment(); } - if (options.singleEntry && options.bundle) { - esbuildOptions.outfile = getOutfile(format, options, context); - } else { - esbuildOptions.outdir = options.outputPath; + if (!esbuildOptions.outfile && !esbuildOptions.outdir) { + if (options.singleEntry && options.bundle && !esbuildOptions.splitting) { + esbuildOptions.outfile = getOutfile(format, options, context); + } else { + esbuildOptions.outdir = options.outputPath; + } } const entryPoints = options.additionalEntryPoints