Open bhandanyan-nomad opened 1 month ago
metro.config.js file contents:
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
let defaultConfig = getDefaultConfig(__dirname);
const { assetExts, sourceExts } = defaultConfig.resolver;
/**
* Metro configuration
* https://reactnative.dev/docs/metro
*
* @type {import('metro-config').MetroConfig}
*/
const config = {
transformer: {
babelTransformerPath: require.resolve('react-native-svg-transformer'),
minifierConfig: {
keep_classnames: true, // Preserve class names
keep_fnames: true, // Preserve function names
mangle: {
keep_classnames: true, // Preserve class names
keep_fnames: true, // Preserve function names
},
},
},
maxWorkers: 2,
resolver: {
assetExts: assetExts.filter(ext => ext !== 'svg'),
sourceExts: [...sourceExts, 'svg'],
},
};
// If I use just the local config, my app works in an iOS simulator
// Produced the working config in issue description
// console.log(config);
// module.exports = config;
// If I use the merged config, my app breaks in the iOS simulator
const merged = mergeConfig(defaultConfig, config);
// Produced the broken config in issue description
// console.log(merged);
module.exports = merged;
It seems the issue is specifically getTransformOptions
If I add delete merged.transformer.getTransformOptions;
to my metro config my app works again
Environment
Things I’ve done to figure out my issue
Upgrading version
0.72.14
Description
Upon upgrading to 0.72+, my app stops working. It still builds and runs, but certain features are fatally broken. The main things that are broken are:
So far I've narrowed down my issue to the metro configuration. As soon as I merge my configuration with the new defaultConfiguration the app breaks as described. If I revert back to my old configuration, it works on iOS (but Android fails to build).
Working config:
Broken config:
I may need to individually remove these extra entries to find the one one that is causing my issue, but I was wondering if anyone has ideas as to which configuration option (or options) specifically could be causing my issue.
Reproducible demo
Don't have one yet