UNPKG

@nx/rspack

Version:

The Nx Plugin for Rspack contains executors and generators that support building applications using Rspack.

41 lines (40 loc) 1.67 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.withNx = withNx; const normalize_assets_1 = require("./normalize-assets"); const apply_base_config_1 = require("../plugins/utils/apply-base-config"); const deprecation_1 = require("./deprecation"); const processed = new Set(); /** * @deprecated Will be removed in Nx v24. Use `NxAppRspackPlugin` from * `@nx/rspack/app-plugin` in a standard rspack config and run * `nx g @nx/rspack:convert-to-inferred`. See * https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details. * @param {WithNxOptions} pluginOptions * @returns {NxComposableRspackPlugin} */ function withNx(pluginOptions = {}) { (0, deprecation_1.warnRspackComposeHelpersDeprecation)(); return function makeConfig(config, { options, context }) { if (processed.has(config)) return config; (0, apply_base_config_1.applyBaseConfig)({ ...options, ...pluginOptions, target: options.target ?? 'web', assets: options.assets ? options.assets : pluginOptions.assets ? (0, normalize_assets_1.normalizeAssets)(pluginOptions.assets, options.root, options.sourceRoot) : [], root: context.root, projectName: context.projectName, targetName: context.targetName, configurationName: context.configurationName, projectGraph: context.projectGraph, useLegacyHtmlPlugin: pluginOptions.useLegacyHtmlPlugin ?? false, }, config); processed.add(config); return config; }; }