Encrypted-Chat-Client/metro.config.js
2024-12-15 06:40:35 -08:00

66 lines
1.9 KiB
JavaScript

// metro.config.js
const { getDefaultConfig } = require('expo/metro-config')
const { withTamagui } = require('@tamagui/metro-plugin')
const config = getDefaultConfig(__dirname)
// metro.config.js
const path = require('path');
module.exports = {
resolver: {
extraNodeModules: {
crypto: require.resolve('crypto-browserify'),
process: require.resolve('process/browser'),
stream: require.resolve('stream-browserify'),
buffer: require.resolve('buffer'),
util: require.resolve('util'),
},
},
};
// Add Tamagui to the Metro config
module.exports = withTamagui(config, {
components: ['tamagui'], // Optional: Specify the components to optimize
config: './tamagui.config.ts', // Path to your Tamagui config
outputCSS: './tamagui-web.css', // Optional: Output CSS for web support
})
// REMOVE THIS (just for tamagui internal devs to work in monorepo):
// if (process.env.IS_TAMAGUI_DEV && __dirname.includes('tamagui')) {
// const fs = require('fs')
// const path = require('path')
// const projectRoot = __dirname
// const monorepoRoot = path.resolve(projectRoot, '../..')
// config.watchFolders = [monorepoRoot]
// config.resolver.nodeModulesPaths = [
// path.resolve(projectRoot, 'node_modules'),
// path.resolve(monorepoRoot, 'node_modules'),
// ]
// // have to manually de-deupe
// try {
// fs.rmSync(path.join(projectRoot, 'node_modules', '@tamagui'), {
// recursive: true,
// force: true,
// })
// } catch {}
// try {
// fs.rmSync(path.join(projectRoot, 'node_modules', 'tamagui'), {
// recursive: true,
// force: true,
// })
// } catch {}
// try {
// fs.rmSync(path.join(projectRoot, 'node_modules', 'react'), {
// recursive: true,
// force: true,
// })
// } catch {}
// try {
// fs.rmSync(path.join(projectRoot, 'node_modules', 'react-dom'), {
// recursive: true,
// force: true,
// })
// } catch {}
// }