@nx/react-native
Version:
29 lines (28 loc) • 1.49 kB
JavaScript
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);
}
}
}
}
;