UNPKG

@nx/react

Version:

The React plugin for Nx contains executors and generators for managing React applications and libraries within an Nx workspace. It provides: - Integration with libraries such as Jest, Vitest, Playwright, Cypress, and Storybook. - Generators for applica

30 lines (29 loc) 1.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.addMfEnvToTargetDefaultInputs = addMfEnvToTargetDefaultInputs; const devkit_1 = require("@nx/devkit"); const internal_1 = require("@nx/devkit/internal"); function addMfEnvToTargetDefaultInputs(tree, bundler) { const nxJson = (0, devkit_1.readNxJson)(tree) ?? {}; const executor = bundler === 'rspack' ? '@nx/rspack:rspack' : '@nx/webpack:webpack'; const mfEnvVar = 'NX_MF_DEV_REMOTES'; const existing = (0, internal_1.findTargetDefault)(nxJson.targetDefaults, { executor }); const inputs = [...(existing?.inputs ?? ['production', '^production'])]; let mfEnvVarExists = false; for (const input of inputs) { if (typeof input === 'object' && input['env'] === mfEnvVar) { mfEnvVarExists = true; break; } } if (!mfEnvVarExists) { inputs.push({ env: mfEnvVar }); } (0, internal_1.upsertTargetDefault)(tree, nxJson, { executor, cache: true, inputs, dependsOn: existing?.dependsOn ?? ['^build'], }); (0, devkit_1.updateNxJson)(tree, nxJson); }