Skip to content

Commit eaafbdb

Browse files
committed
test check
1 parent 9b9f6bd commit eaafbdb

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

vnext/template/metro.config.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
22

3+
const { pathToFileURL } = require('node:url');
34
const fs = require('fs');
45
const path = require('path');
56
const exclusionList = require('metro-config/src/defaults/exclusionList');
67

7-
const rnwPath = fs.realpathSync(
8+
const rnwPath = pathToFileURL(fs.realpathSync(
89
path.resolve(require.resolve('react-native-windows/package.json'), '..'),
9-
);
10+
));
1011

1112
//{{#devMode}} [devMode
12-
const rnwRootNodeModules = path.resolve(rnwPath, '..', 'node_modules');
13-
const rnwPackages = path.resolve(rnwPath, '..', 'packages');
13+
const rnwRootNodeModules = pathToFileURL(path.resolve(rnwPath, '..', 'node_modules'));
14+
const rnwPackages = pathToFileURL(path.resolve(rnwPath, '..', 'packages'));
1415
// devMode]{{/devMode}}
1516

1617
/**
@@ -28,7 +29,7 @@ const config = {
2829
blockList: exclusionList([
2930
// This stops "npx @react-native-community/cli run-windows" from causing the metro server to crash if its already running
3031
new RegExp(
31-
`${path.resolve(__dirname, 'windows').replace(/[/\\]/g, '/')}.*`,
32+
pathToFileURL(`${path.resolve(__dirname, 'windows').replace(/[/\\]/g, '/')}.*`),
3233
),
3334
// This prevents "npx @react-native-community/cli run-windows" from hitting: EBUSY: resource busy or locked, open msbuild.ProjectImports.zip or other files produced by msbuild
3435
new RegExp(`${rnwPath}/build/.*`),

vnext/templates/cpp-app/metro.config.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
2-
2+
const { pathToFileURL } = require('node:url');
33
const fs = require('fs');
44
const path = require('node:path');
55
const exclusionList = require('metro-config/src/defaults/exclusionList');
66

7-
const rnwPath = fs.realpathSync(
8-
path.resolve(require.resolve('react-native-windows/package.json'), '..'),
7+
const rnwPath = pathToFileURL(fs.realpathSync(
8+
path.resolve(require.resolve('react-native-windows/package.json'), '..')),
99
);
1010

1111
//{{#devMode}} [devMode
12-
const rnwRootNodeModules = path.resolve(rnwPath, '..', 'node_modules');
13-
const rnwPackages = path.resolve(rnwPath, '..', 'packages');
12+
const rnwRootNodeModules = pathToFileURL(path.resolve(rnwPath, '..', 'node_modules'));
13+
const rnwPackages = pathToFileURL(path.resolve(rnwPath, '..', 'packages'));
1414
// devMode]{{/devMode}}
1515

1616
/**
@@ -28,7 +28,7 @@ const config = {
2828
blockList: exclusionList([
2929
// This stops "npx @react-native-community/cli run-windows" from causing the metro server to crash if its already running
3030
new RegExp(
31-
`${path.resolve(__dirname, 'windows').replace(/[/\\]/g, '/')}.*`,
31+
pathToFileURL(`${path.resolve(__dirname, 'windows').replace(/[/\\]/g, '/')}.*`),
3232
),
3333
// This prevents "npx @react-native-community/cli run-windows" from hitting: EBUSY: resource busy or locked, open msbuild.ProjectImports.zip or other files produced by msbuild
3434
new RegExp(`${rnwPath}/build/.*`),

vnext/templates/cpp-lib/example/metro.config.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
22
const fs = require('fs');
33
const path = require('node:path');
4+
const { pathToFileURL } = require('node:url');
45
const escape = require('escape-string-regexp');
56
const exclusionList = require('metro-config/src/defaults/exclusionList');
67
const pack = require('../package.json');
78

89
const root = path.resolve(__dirname, '..');
910
const modules = Object.keys({ ...pack.peerDependencies });
1011

11-
const rnwPath = fs.realpathSync(
12-
path.resolve(require.resolve('react-native-windows/package.json'), '..'),
12+
const rnwPath = pathToFileURL(fs.realpathSync(
13+
path.resolve(require.resolve('react-native-windows/package.json'), '..')),
1314
);
1415

1516
//{{#devMode}} [devMode
16-
const rnwRootNodeModules = path.resolve(rnwPath, '..', 'node_modules');
17-
const rnwPackages = path.resolve(rnwPath, '..', 'packages');
17+
const rnwRootNodeModules = pathToFileURL(path.resolve(rnwPath, '..', 'node_modules'));
18+
const rnwPackages = pathToFileURL(path.resolve(rnwPath, '..', 'packages'));
1819
// devMode]{{/devMode}}
1920

2021
/**
@@ -40,7 +41,7 @@ const config = {
4041
).concat([
4142
// This stops "npx @react-native-community/cli run-windows" from causing the metro server to crash if its already running
4243
new RegExp(
43-
`${path.resolve(__dirname, 'windows').replace(/[/\\]/g, '/')}.*`,
44+
pathToFileURL(`${path.resolve(__dirname, 'windows').replace(/[/\\]/g, '/')}.*`),
4445
),
4546
// This prevents "npx @react-native-community/cli run-windows" from hitting: EBUSY: resource busy or locked, open msbuild.ProjectImports.zip or other files produced by msbuild
4647
new RegExp(`${rnwPath}/build/.*`),
@@ -50,7 +51,7 @@ const config = {
5051
),
5152

5253
extraNodeModules: modules.reduce((acc, name) => {
53-
acc[name] = path.join(__dirname, 'node_modules', name);
54+
acc[name] = pathToFileURL(path.join(__dirname, 'node_modules', name));
5455
return acc;
5556
},
5657
{

0 commit comments

Comments
 (0)