diff --git a/packages/webpack/src/executors/webpack/webpack.impl.ts b/packages/webpack/src/executors/webpack/webpack.impl.ts index 59f61c7ff00e5d..e9c2323763270b 100644 --- a/packages/webpack/src/executors/webpack/webpack.impl.ts +++ b/packages/webpack/src/executors/webpack/webpack.impl.ts @@ -23,7 +23,7 @@ import type { } from './schema'; import { normalizeOptions } from './lib/normalize-options'; import { - composePlugins, + composePluginsSync, isNxWebpackComposablePlugin, } from '../../utils/config'; import { withNx } from '../../utils/with-nx'; @@ -54,7 +54,12 @@ async function getWebpackConfigs( const config = options.isolatedConfig ? {} - : composePlugins(withNx(options), withWeb(options)); + : (options.target === 'web' + ? composePluginsSync(withNx(options), withWeb(options)) + : withNx(options))( + {}, + { options, context } + ); if (isNxWebpackComposablePlugin(userDefinedWebpackConfig)) { // Old behavior, call the Nx-specific webpack config function that user exports