Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "[0.73] Update app template's metro config with latest upstream changes",
"packageName": "react-native-windows",
"email": "jthysell@microsoft.com",
"dependentChangeType": "patch"
}
19 changes: 12 additions & 7 deletions vnext/template/metro.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @format
*/
const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');

const fs = require('fs');
const path = require('path');
const exclusionList = require('metro-config/src/defaults/exclusionList');
Expand All @@ -12,7 +8,14 @@ const rnwPath = fs.realpathSync(
path.resolve(require.resolve('react-native-windows/package.json'), '..'),
);

module.exports = {
/**
* Metro configuration
* https://facebook.github.io/metro/docs/configuration
*
* @type {import('metro-config').MetroConfig}
*/

const config = {
resolver: {
blockList: exclusionList([
// This stops "react-native run-windows" from causing the metro server to crash if its already running
Expand All @@ -36,3 +39,5 @@ module.exports = {
assetRegistryPath: 'react-native/Libraries/Image/AssetRegistry',
},
};

module.exports = mergeConfig(getDefaultConfig(__dirname), config);
21 changes: 14 additions & 7 deletions vnext/template/metro.devMode.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @format
*/
const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');

const fs = require('fs');
const path = require('path');
const exclusionList = require('metro-config/src/defaults/exclusionList');
Expand All @@ -17,7 +13,14 @@ const rnwRootNodeModules = path.resolve(rnwPath, '..', 'node_modules');
const rnwPackages = path.resolve(rnwPath, '..', 'packages');
// devMode]

module.exports = {
/**
* Metro configuration
* https://facebook.github.io/metro/docs/configuration
*
* @type {import('metro-config').MetroConfig}
*/

const config = {
// [devMode
watchFolders: [rnwPath, rnwRootNodeModules, rnwPackages],
// devMode]
Expand Down Expand Up @@ -45,5 +48,9 @@ module.exports = {
inlineRequires: true,
},
}),
// This fixes the 'missing-asset-registry-path` error (see https://github.com/microsoft/react-native-windows/issues/11437)
assetRegistryPath: 'react-native/Libraries/Image/AssetRegistry',
},
};

module.exports = mergeConfig(getDefaultConfig(__dirname), config);
19 changes: 12 additions & 7 deletions vnext/templates/cpp-app/metro.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @format
*/
const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');

const fs = require('fs');
const path = require('path');
const exclusionList = require('metro-config/src/defaults/exclusionList');
Expand All @@ -17,7 +13,14 @@ const rnwRootNodeModules = path.resolve(rnwPath, '..', 'node_modules');
const rnwPackages = path.resolve(rnwPath, '..', 'packages');
// devMode]{{/devMode}}

module.exports = {
/**
* Metro configuration
* https://facebook.github.io/metro/docs/configuration
*
* @type {import('metro-config').MetroConfig}
*/

const config = {
//{{#devMode}} [devMode
watchFolders: [rnwPath, rnwRootNodeModules, rnwPackages],
// devMode]{{/devMode}}
Expand Down Expand Up @@ -49,3 +52,5 @@ module.exports = {
assetRegistryPath: 'react-native/Libraries/Image/AssetRegistry',
},
};

module.exports = mergeConfig(getDefaultConfig(__dirname), config);