expo-popcore-app/metro.config.js

35 lines
982 B
JavaScript

const { getDefaultConfig } = require('expo/metro-config')
const { withNativeWind } = require('nativewind/metro')
const config = getDefaultConfig(__dirname)
/**
* Exclude test files from Metro bundler
* https://www.better-auth.com/docs/integrations/expo#expo-client
*/
config.resolver.sourceExts = config.resolver.sourceExts.filter(ext => ext !== 'test')
config.resolver.resolverMainFields = ['react-native', 'browser', 'main']
// Exclude test files from being bundled
config.resolver.blockList = [
/.*\.test\.[jt]sx?$/,
/.*\.spec\.[jt]sx?$/,
]
config.server = {
...config.server,
enhanceMiddleware: (middleware) => {
return (req, res, next) => {
// Block requests to test files
if (req.url.match(/\.(test|spec)\.(js|jsx|ts|tsx)$/)) {
res.statusCode = 404
res.end('Test files are not served')
return
}
return middleware(req, res, next)
}
}
}
module.exports = withNativeWind(config, { input: './global.css' })