const { getDefaultConfig } = require('metro-config');

const { ROOT_DIR } = require('@grund/path');

async function createConfig() {
	const { resolver } = await getDefaultConfig();
	const { sourceExts, assetExts } = resolver;

	return {
		projectRoot: ROOT_DIR,
		transformer: {
			babelTransformerPath: require.resolve('react-native-svg-transformer'),
		},
		resolver: {
			assetExts: assetExts.filter((ext) => ext !== 'svg'),
			sourceExts: [...sourceExts, 'svg'],
		},
	};
}

module.exports = createConfig();
