Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
transformer: Transformer,
variants?: TransformVariants,
|};
const NODE_MODULES = path.sep + 'node_modules' + path.sep;
const defaultTransformOptions = {
dev: false,
hot: false,
inlineRequires: false,
minify: true,
platform: '',
projectRoot: '',
};
const defaultVariants = {default: {}};
const ASSET_EXTENSIONS = new Set(defaults.assetExts);
function transformModule(
content: Buffer,
options: TransformOptions,
): TransformedSourceFile {
const ext = path.extname(options.filename).substr(1);
if (ASSET_EXTENSIONS.has(ext)) {
return transformAsset(content, options.filename);
}
if (ext === 'json') {
return transformJSON(content.toString('utf8'), options);
}
if (!options.sourceExts.has(ext)) {
return {type: 'unknown'};
}
/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @format
*/
const defaultAssetExts = require('metro-config/src/defaults/defaults').assetExts
const defaultSourceExts = require('metro-config/src/defaults/defaults').sourceExts
const exclusionList = require('metro-config/src/defaults/exclusionList')
module.exports = {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
babelTransformerPath: require.resolve('react-native-svg-transformer'),
},
resolver: {
extraNodeModules: require('node-libs-react-native'),
assetExts: defaultAssetExts.filter((ext) => ext !== 'svg'),