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

28 lines (27 loc) 1.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.withReact = withReact; const apply_react_config_1 = require("./nx-react-webpack-plugin/lib/apply-react-config"); const deprecation_1 = require("../src/utils/deprecation"); const processed = new Set(); /** * @deprecated Will be removed in Nx v24. Use `NxReactWebpackPlugin` from * `@nx/react/webpack-plugin` in a standard webpack config and run * `nx g @nx/webpack:convert-to-inferred`. See * https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details. * @param {WithReactOptions} pluginOptions * @returns {NxWebpackPlugin} */ function withReact(pluginOptions = {}) { (0, deprecation_1.warnReactWithReactDeprecation)(); return function configure(config, context) { const { withWeb } = require('@nx/webpack'); if (processed.has(config)) return config; // Apply web config for CSS, JSX, index.html handling, etc. config = withWeb(pluginOptions)(config, context); (0, apply_react_config_1.applyReactConfig)({}, config); processed.add(config); return config; }; }