I’m on a monorepo with yarn workspace and I’m also using react-native-svg-transformer. I have updated the sdk to the sdk 40 and I have this error in the metro.config.js :
and there is my metro.config.js :
const { createMetroConfiguration } = require('expo-yarn-workspaces');
const { getDefaultConfig } = require('@expo/metro-config');
const configuration = createMetroConfiguration(__dirname);
module.exports = (async () => {
const {
resolver: { sourceExts },
} = await getDefaultConfig();
return {
transformer: {
babelTransformerPath: require.resolve('react-native-svg-transformer'),
},
resolver: {
...configuration.resolver,
assetExts: configuration.resolver.assetExts.filter(ext => ext !== 'svg'),
sourceExts: [...sourceExts, 'svg'],
// NOTE: using native entrypoint because bug in metro
resolverMainFields: ['native', 'module', 'browser', 'main'],
},
};
})();
If you have any idea ?
I’m on a monorepo with yarn workspace and I’m also using react-native-svg-transformer. I have updated the sdk to the sdk 40 and I have this error in the metro.config.js :
and there is my metro.config.js :
const { createMetroConfiguration } = require('expo-yarn-workspaces');
const { getDefaultConfig } = require('@expo/metro-config');
const configuration = createMetroConfiguration(__dirname);
module.exports = (async () => {
const {
resolver: { sourceExts },
} = await getDefaultConfig();
return {
transformer: {
babelTransformerPath: require.resolve('react-native-svg-transformer'),
},
resolver: {
...configuration.resolver,
assetExts: configuration.resolver.assetExts.filter(ext => ext !== 'svg'),
sourceExts: [...sourceExts, 'svg'],
// NOTE: using native entrypoint because bug in metro https://github./facebook/metro/issues/485
resolverMainFields: ['native', 'module', 'browser', 'main'],
},
};
})();
If you have any idea ?
Share Improve this question asked Mar 29, 2021 at 19:42 E.DE.D 8913 gold badges17 silver badges35 bronze badges 4- Hey there E.D! How did you resolve this? Did you handle with that new library you've mentioned down here? – On the way to success Commented Sep 21, 2021 at 3:33
- 1 @Onthewaytosuccess yes as I was able to indicate in the ment below ;) – E.D Commented Sep 21, 2021 at 13:22
- Hey I got it solved somehow @E.D – On the way to success Commented Sep 27, 2021 at 6:36
- Could you share the answer? @Onthewaytosuccess – Theo Oliveira Commented May 3, 2024 at 13:11
1 Answer
Reset to default 17Add the __dirname
param in await getDefaultConfig()
so it should be await getDefaultConfig(__dirname)
It is required as per docs