react-native-video/examples/basic/metro.config.js
Olivier Bouillet c1c7a056f1
chore: move sample to expo (#3880)
* perf: ensure we do not provide callback to native if no callback provided from app

* chore: rework bufferConfig to make it more generic and reduce ReactExoplayerView code size

* chore: improve issue template

* fix(android): avoid video view flickering at playback startup

* fix: ensure player doesn't start when view is unmounted

* chore: move basic sample to expo

* Update examples/basic/package.json

Co-authored-by: Krzysztof Moch <krzysmoch.programs@gmail.com>

* chore: use last expo version

* chore: fix podfile

---------

Co-authored-by: Krzysztof Moch <krzysmoch.programs@gmail.com>
2024-06-20 11:58:55 +02:00

71 lines
2.2 KiB
JavaScript

/**
* Metro configuration for React Native
* https://reactnative.dev/docs/metro
*
* @format
*/
const path = require('path');
const escape = require('escape-string-regexp');
const blacklist = require('metro-config/src/defaults/exclusionList');
const { getDefaultConfig } = require('expo/metro-config');
const { mergeConfig } = require('@react-native/metro-config');
const pak = require('../../package.json');
const root = path.resolve(__dirname, '../..');
const modules = Object.keys({...pak.peerDependencies});
const defaultConfig = getDefaultConfig(__dirname)
const { resolver, transformer } = defaultConfig
/**
* Metro configuration
* https://facebook.github.io/metro/docs/configuration
*
* @type {import('metro-config').MetroConfig}
*/
const config = {
watchFolders: [root],
resolver: {
...resolver,
blacklistRE: blacklist([
// This stops "react-native run-windows" from causing the metro server to crash if its already running
new RegExp(
`${path.resolve(__dirname, 'windows').replace(/[/\\]/g, '/')}.*`,
),
// This prevents "react-native run-windows" from hitting: EBUSY: resource busy or locked, open msbuild.ProjectImports.zip
/.*\.ProjectImports\.zip/,
/(.*\/react-native-video\/node_modules\/.*)$/,
// We need to make sure that only one version is loaded for peerDependencies
// So we block them at the root, and alias them to the versions in example's node_modules
...modules.map(
name =>
new RegExp(`^${escape(path.join(root, 'node_modules', name))}\\/.*$`),
),
]),
extraNodeModules: modules.reduce((acc, name) => {
acc[name] = path.join(__dirname, 'node_modules', name);
return acc;
}, {}),
nodeModulesPaths: [
path.resolve(path.join(__dirname, './node_modules')),
path.resolve(path.join(__dirname, '../../node_modules')),
],
transformer: {
...transformer,
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: true,
},
}),
},
},
transformer: {
...transformer, // <--- THIS WAS MISSING
},
};
module.exports = mergeConfig(defaultConfig, config);