[DevTools] Fix moduleNameMapper Order in DevTools Config #24602)

We need the regression config moduleNameMapper to come before the current moduleNameMapper so when it tries to map "/^react-dom\/([^/]+)$/ it doesn't get confused. The reason is because order in which the mappings are defined matters. Patterns are checked one by one until one fits, and the most specific rule should be listed first.
This commit is contained in:
Luna Ruan
2022-05-23 14:18:17 -07:00
committed by GitHub
parent 210fee474d
commit 1e98682dd3
2 changed files with 2 additions and 2 deletions
@@ -734,7 +734,7 @@ describe('ProfilingCache', () => {
}
});
// @reactVersion >= 16.9
// @reactVersion >= 18.0
it('should calculate durations based on actual children (not filtered children)', () => {
store.componentFilters = [utils.createDisplayNameFilter('^Parent$')];
+1 -1
View File
@@ -51,8 +51,8 @@ moduleNameMapper['^react-reconciler/([^/]+)$'] =
module.exports = Object.assign({}, baseConfig, {
// Redirect imports to the compiled bundles
moduleNameMapper: {
...moduleNameMapper,
...devtoolsRegressionConfig.moduleNameMapper,
...moduleNameMapper,
},
// Don't run bundle tests on -test.internal.* files
testPathIgnorePatterns: ['/node_modules/', '-test.internal.js$'],