mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-05-30 05:31:01 +00:00
fix: example apps metro paths (#2511)
# Summary Fixes paths in Metro config
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
|
||||
const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
|
||||
|
||||
/**
|
||||
* Metro configuration
|
||||
@@ -9,14 +9,14 @@ const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
|
||||
const path = require('path');
|
||||
const exclusionList = require('metro-config/src/defaults/exclusionList');
|
||||
const escape = require('escape-string-regexp');
|
||||
const pack = require('../package.json');
|
||||
const pack = require('../../package.json');
|
||||
|
||||
const root = path.resolve(__dirname, '..');
|
||||
const root = path.resolve(__dirname, '../..');
|
||||
const projectNodeModules = path.join(__dirname, 'node_modules');
|
||||
|
||||
const fs = require('fs');
|
||||
const rnwPath = fs.realpathSync(
|
||||
path.resolve(require.resolve('react-native-windows/package.json'), '..')
|
||||
path.resolve(require.resolve('react-native-windows/package.json'), '..'),
|
||||
);
|
||||
|
||||
const modules = [...Object.keys(pack.peerDependencies), 'react-native-windows'];
|
||||
@@ -30,16 +30,17 @@ const config = {
|
||||
resolver: {
|
||||
blockList: exclusionList(
|
||||
modules.map(
|
||||
(m) =>
|
||||
new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`)
|
||||
m => new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`),
|
||||
),
|
||||
// This stops "react-native run-windows" from causing the metro server to
|
||||
// crash if its already running
|
||||
new RegExp(`${path.join(__dirname, 'windows').replace(/[/\\]+/g, '/')}.*`),
|
||||
new RegExp(
|
||||
`${path.join(__dirname, 'windows').replace(/[/\\]+/g, '/')}.*`,
|
||||
),
|
||||
// This prevents "react-native run-windows" from hitting: EBUSY: resource busy or locked, open msbuild.ProjectImports.zip or other files produced by msbuild
|
||||
new RegExp(`${rnwPath}/build/.*`),
|
||||
new RegExp(`${rnwPath}/target/.*`),
|
||||
/.*\.ProjectImports\.zip/
|
||||
/.*\.ProjectImports\.zip/,
|
||||
),
|
||||
nodeModulesPaths: [projectNodeModules, path.join(__dirname, '../../')],
|
||||
extraNodeModules: modules.reduce((acc, name) => {
|
||||
|
||||
Reference in New Issue
Block a user