fix(example): remove dependency loop (#3353)
* chore(examples/basic): fix eslint config * chore(examples/basic): change manual linking for react-native-video * Update examples/basic/package.json Co-authored-by: Olivier Bouillet <62574056+freeboub@users.noreply.github.com> --------- Co-authored-by: Olivier Bouillet <62574056+freeboub@users.noreply.github.com>
This commit is contained in:
@@ -5,9 +5,15 @@
|
||||
* @format
|
||||
*/
|
||||
const path = require('path');
|
||||
const escape = require('escape-string-regexp');
|
||||
|
||||
const blacklist = require('metro-config/src/defaults/exclusionList');
|
||||
const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
|
||||
|
||||
const pak = require('../../package.json');
|
||||
const root = path.resolve(__dirname, '../..');
|
||||
const modules = Object.keys({...pak.peerDependencies});
|
||||
|
||||
/**
|
||||
* Metro configuration
|
||||
* https://facebook.github.io/metro/docs/configuration
|
||||
@@ -15,6 +21,7 @@ const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
|
||||
* @type {import('metro-config').MetroConfig}
|
||||
*/
|
||||
const config = {
|
||||
watchFolders: [root],
|
||||
resolver: {
|
||||
blacklistRE: blacklist([
|
||||
// This stops "react-native run-windows" from causing the metro server to crash if its already running
|
||||
@@ -24,7 +31,26 @@ const config = {
|
||||
// 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;
|
||||
}, {}),
|
||||
transformer: {
|
||||
getTransformOptions: async () => ({
|
||||
transform: {
|
||||
experimentalImportSupport: false,
|
||||
inlineRequires: true,
|
||||
},
|
||||
}),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user