UNPKG

@nx/react-native

Version:

The Nx Plugin for React Native contains generators for managing React Native applications and libraries within an Nx workspace. It provides: -Integration with libraries such as Jest, Detox, and Storybook. -Scaffolding for creating buildable libraries th

29 lines (28 loc) 1.49 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = update; const devkit_1 = require("@nx/devkit"); /** * This migration removes blockList in metro.config.js. * It is now excluding dist folder in watchFolders in withNxMetro. */ async function update(tree) { const projects = (0, devkit_1.getProjects)(tree); for (const [_, config] of projects.entries()) { if (config.targets?.['start']?.executor === '@nx/react-native:start') { if (tree.exists((0, devkit_1.joinPathFragments)(config.root, 'metro.config.js'))) { let content = tree .read((0, devkit_1.joinPathFragments)(config.root, 'metro.config.js')) .toString(); content = content.replace(/blockList: exclusionList(.+?(?=\n))/, ''); content = content.replace('// unstable_enableSymlinks: true,', ''); content = content.replace('// unstable_enablePackageExports: true,', ''); content = content.replace('unstable_enableSymlinks: true,', ''); content = content.replace('unstable_enablePackageExports: true,', ''); content = content.replace(`const exclusionList = require('metro-config/src/defaults/exclusionList');`, ''); tree.write((0, devkit_1.joinPathFragments)(config.root, 'metro.config.js'), content); await (0, devkit_1.formatFiles)(tree); } } } }