/* eslint-env node */ /* eslint-disable */ const { getDefaultConfig } = require("expo/metro-config"); const path = require("path"); const root = path.resolve(__dirname, "../.."); const nodeModulesPaths = [ path.resolve(__dirname, "node_modules") ]; const config = getDefaultConfig(__dirname); config.watchFolders = [root]; config.resolver.extraNodeModules = { "ncore-ui-kit-mobile": path.resolve(root, "src"), "react": path.resolve(__dirname, "node_modules/react"), "react-native": path.resolve(__dirname, "node_modules/react-native") }; config.resolver.nodeModulesPaths = nodeModulesPaths; config.resolver.disableHierarchicalLookup = true; config.resolver.blockList = [ new RegExp(`${path.resolve(root, "example", "web", "node_modules").replace(/\\/g, "\\\\")}.*`), ]; config.resolver.resolveRequest = (context, moduleName, platform) => { const forceLocal = ["react", "react-native"]; const match = forceLocal.find( (pkg) => moduleName === pkg || moduleName.startsWith(`${pkg}/`) ); if (match) { const filePath = require.resolve(moduleName, { paths: [__dirname], }); return { filePath, type: "sourceFile" }; } return context.resolveRequest(context, moduleName, platform); }; module.exports = config;