Skip to content

Conversation

@MajorLift
Copy link
Contributor

@MajorLift MajorLift commented Nov 20, 2025

Description

  • Enables React Compiler code transformation and optimizations for Webpack builds.
  • Adds --reactCompilerVerbose Webpack cli argument, which outputs file compilation status, errors, statistics.
    • yarn webpack --reactCompilerVerbose output:
Screenshot 2025-11-21 at 3 54 04 PM

Open in GitHub Codespaces

Changelog

CHANGELOG entry: null (build)

Related issues

Manual testing steps

  1. Create Webpack dev build using yarn webpack --no-cache.
  2. Inspect dist/{chrome,firefox}/js-ui_{com,d,p,pages}*
  3. Search for "react_compiler_runtime"
  4. There should be dozens to hundreds of matches along with React Compiler-transformed code like the following:
  const $ = (0,react_compiler_runtime__WEBPACK_IMPORTED_MODULE_0__.c)(4);
  let t2;
  if ($[0] !== t1) {
    t2 = t1 === undefined ? {
      expireClipboard: true
    } : t1;
    $[0] = t1;
    $[1] = t2;
  } else {
    t2 = $[1];
  }

Screenshots/Recordings

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Enable React Compiler via react-compiler-webpack for selected UI sources, with config, policies, and deps updates.

  • Build/Webpack:
    • Add React Compiler loader (react-compiler-webpack) with rule targeting ui/(components|contexts|hooks|layouts|pages) via UI_DIR_RE.
    • Define reactCompilerOptions (target 17) and wire into loader options.
  • Helpers/Config:
    • Introduce UI_DIR_RE in utils/helpers.ts.
    • Export reactCompilerOptions in utils/config.ts.
  • Security/Policies (LavaMoat):
    • Allow react-compiler-runtime and map JSX syntax deps to react-compiler-webpack in build-system policy.
    • Add react-compiler-runtime resources to MV2/MV3 webpack policies.
  • Dependencies:
    • Add react-compiler-webpack to package.json and ignore list in .depcheckrc.yml.
    • Update lockfile and babel plugin syntax entries to support the compiler.

Written by Cursor Bugbot for commit 54d4402. This will update automatically on new commits. Configure here.

@github-actions
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-extension-platform Extension Platform team label Nov 20, 2025
@socket-security
Copy link

socket-security bot commented Nov 20, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedreact-compiler-webpack@​1.0.0961008988100

View full report

@MajorLift
Copy link
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

No policy changes

@MajorLift MajorLift force-pushed the jongsun/build/enable-react-compiler-webpack branch from 4df456e to e1f1daa Compare November 20, 2025 11:47
@MajorLift
Copy link
Contributor Author

@metamaskbot update-policies

@MajorLift MajorLift force-pushed the jongsun/build/enable-react-compiler-webpack branch from e1f1daa to 20b99b9 Compare November 20, 2025 12:01
@metamaskbot
Copy link
Collaborator

No policy changes

@MajorLift
Copy link
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policy update failed. You can review the logs or retry the policy update here

1 similar comment
@metamaskbot
Copy link
Collaborator

Policy update failed. You can review the logs or retry the policy update here

@MajorLift
Copy link
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

No policy changes

1 similar comment
@metamaskbot
Copy link
Collaborator

No policy changes

@MajorLift MajorLift force-pushed the jongsun/build/enable-react-compiler-webpack branch from 20b99b9 to 3db3c08 Compare November 20, 2025 15:13
@MajorLift
Copy link
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policies updated.
👀 Please review the diff for suspicious new powers.

🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff

@metamaskbot
Copy link
Collaborator

metamaskbot commented Nov 20, 2025

✨ Files requiring CODEOWNER review ✨

🧩 @MetaMask/extension-devs (3 files, +19 -3)
  • 📁 lavamoat/
    • 📁 build-system/
      • 📄 policy.json +3 -3
    • 📁 webpack/
      • 📁 mv2/
        • 📄 policy.json +8 -0
      • 📁 mv3/
        • 📄 policy.json +8 -0

📜 @MetaMask/policy-reviewers (3 files, +19 -3)
  • 📁 lavamoat/
    • 📁 build-system/
      • 📄 policy.json +3 -3
    • 📁 webpack/
      • 📁 mv2/
        • 📄 policy.json +8 -0
      • 📁 mv3/
        • 📄 policy.json +8 -0

Tip

Follow the policy review process outlined in the LavaMoat Policy Review Process doc before expecting an approval from Policy Reviewers.


🔗 @MetaMask/supply-chain (3 files, +19 -3)
  • 📁 lavamoat/
    • 📁 build-system/
      • 📄 policy.json +3 -3
    • 📁 webpack/
      • 📁 mv2/
        • 📄 policy.json +8 -0
      • 📁 mv3/
        • 📄 policy.json +8 -0

@metamaskbot
Copy link
Collaborator

Builds ready [c4f11c5]
UI Startup Metrics (1222 ± 95 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1222106815609512781395
load104591513629010951203
domContentLoaded103991213548810901193
domInteractive231490162074
firstPaint53281136641210081176
backgroundConnect21419330613218232
firstReactRender31196993549
getState331762114056
initialActions105113
loadScripts831705114288884993
setupStore1072431216
numNetworkReqs1257721574
BrowserifyPower User HomeuiStartup18711575274225320482320
load997865166515810031419
domContentLoaded98285716511579821408
domInteractive36162404030149
firstPaint5038215683769051090
backgroundConnect21919826112227242
firstReactRender7445114127994
getState18113234747192301
initialActions103011
loadScripts78066314431587781204
setupStore1893782434
numNetworkReqs1477527950196232
WebpackStandard HomeuiStartup------
load------
domContentLoaded------
domInteractive------
firstPaint------
backgroundConnect------
firstReactRender------
getState------
initialActions------
loadScripts------
setupStore------
numNetworkReqs------
WebpackPower User HomeuiStartup------
load------
domContentLoaded------
domInteractive------
firstPaint------
backgroundConnect------
firstReactRender------
getState------
initialActions------
loadScripts------
setupStore------
numNetworkReqs------
FirefoxBrowserifyStandard HomeuiStartup11951036158010812471416
load101989313167810711182
domContentLoaded101889213157810711182
domInteractive51292353348117
firstPaint------
backgroundConnect3418151173768
firstReactRender21184752132
getState1067310921
initialActions102012
loadScripts99987812937210451139
setupStore95425921
numNetworkReqs1156615659
BrowserifyPower User HomeuiStartup28102153379837730353548
load12411006178019712661648
domContentLoaded12411006178019712651647
domInteractive16434697143165551
firstPaint------
backgroundConnect222241069234267782
firstReactRender89501331897125
getState26080921248215864
initialActions219127
loadScripts1197987173918612061612
setupStore12610786183116730
numNetworkReqs95612123999198
WebpackStandard HomeuiStartup------
load------
domContentLoaded------
domInteractive------
firstPaint------
backgroundConnect------
firstReactRender------
getState------
initialActions------
loadScripts------
setupStore------
numNetworkReqs------
WebpackPower User HomeuiStartup------
load------
domContentLoaded------
domInteractive------
firstPaint------
backgroundConnect------
firstReactRender------
getState------
initialActions------
loadScripts------
setupStore------
numNetworkReqs------
📊 Page Load Benchmark Results

Current Commit: c4f11c5 | Date: 11/20/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.08s (±68ms) 🟡 | historical mean value: 1.03s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 760ms (±67ms) 🟢 | historical mean value: 722ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 81ms (±15ms) 🟢 | historical mean value: 78ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.08s 68ms 1.02s 1.42s 1.31s 1.42s
domContentLoaded 760ms 67ms 712ms 1.08s 984ms 1.08s
firstPaint 81ms 15ms 68ms 212ms 92ms 212ms
firstContentfulPaint 81ms 15ms 68ms 212ms 92ms 212ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

@MajorLift MajorLift force-pushed the jongsun/build/enable-react-compiler-webpack branch from c4f11c5 to 0245a73 Compare November 20, 2025 17:57
@metamaskbot
Copy link
Collaborator

Builds ready [0245a73]
UI Startup Metrics (1199 ± 102 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup11991028161410212561366
load103189313149111011187
domContentLoaded102588813109010951180
domInteractive2314101162063
firstPaint50775131340710161140
backgroundConnect20719226210210227
firstReactRender29195683447
getState321784103553
initialActions103112
loadScripts825696108189900983
setupStore1274451321
numNetworkReqs1257721573
BrowserifyPower User HomeuiStartup18631559327229720022566
load97182318841769611451
domContentLoaded95681818721749451432
domInteractive35151933927152
firstPaint6668915153849251410
backgroundConnect21018926112214240
firstReactRender76431321684102
getState19514341952220304
initialActions104112
loadScripts76264016421697551216
setupStore1784392238
numNetworkReqs1457428954180275
WebpackStandard HomeuiStartup------
load------
domContentLoaded------
domInteractive------
firstPaint------
backgroundConnect------
firstReactRender------
getState------
initialActions------
loadScripts------
setupStore------
numNetworkReqs------
WebpackPower User HomeuiStartup------
load------
domContentLoaded------
domInteractive------
firstPaint------
backgroundConnect------
firstReactRender------
getState------
initialActions------
loadScripts------
setupStore------
numNetworkReqs------
FirefoxBrowserifyStandard HomeuiStartup12471097240016212821511
load1059956220513210931208
domContentLoaded1058952220513210931201
domInteractive56341352673114
firstPaint------
backgroundConnect3521128173769
firstReactRender22184342233
getState10613113919
initialActions102012
loadScripts1039940217913010701146
setupStore14619525934
numNetworkReqs1257317662
BrowserifyPower User HomeuiStartup27181862374739328913592
load1189955172117612351588
domContentLoaded1187950172117612341587
domInteractive14233616129168473
firstPaint------
backgroundConnect23027957256273834
firstReactRender86361642398129
getState27984915277213868
initialActions218237
loadScripts1144936169716311851495
setupStore1376791191134672
numNetworkReqs98612254195206
WebpackStandard HomeuiStartup------
load------
domContentLoaded------
domInteractive------
firstPaint------
backgroundConnect------
firstReactRender------
getState------
initialActions------
loadScripts------
setupStore------
numNetworkReqs------
WebpackPower User HomeuiStartup------
load------
domContentLoaded------
domInteractive------
firstPaint------
backgroundConnect------
firstReactRender------
getState------
initialActions------
loadScripts------
setupStore------
numNetworkReqs------
📊 Page Load Benchmark Results

Current Commit: 0245a73 | Date: 11/20/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±62ms) 🟡 | historical mean value: 1.04s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 727ms (±60ms) 🟢 | historical mean value: 727ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 76ms (±10ms) 🟢 | historical mean value: 79ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 62ms 1.01s 1.30s 1.27s 1.30s
domContentLoaded 727ms 60ms 698ms 993ms 932ms 993ms
firstPaint 76ms 10ms 60ms 160ms 88ms 160ms
firstContentfulPaint 76ms 10ms 60ms 160ms 88ms 160ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

@MajorLift
Copy link
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policies updated.
👀 Please review the diff for suspicious new powers.

🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff

@metamaskbot
Copy link
Collaborator

Builds ready [0b22503]
UI Startup Metrics (1193 ± 82 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1193102213828212511334
load102589211917510851144
domContentLoaded102088911757410811140
domInteractive231383152063
firstPaint4257311933669121106
backgroundConnect2041922488207222
firstReactRender29194983446
getState31166383547
initialActions105112
loadScripts82167497674881943
setupStore1051931116
numNetworkReqs1257820574
BrowserifyPower User HomeuiStartup19081560298826021182353
load1021884182116410331453
domContentLoaded1005872180816110061434
domInteractive36162394127161
firstPaint5919515194189631372
backgroundConnect22419927714231249
firstReactRender78431351484104
getState17912834943197264
initialActions103112
loadScripts79867215901588001217
setupStore20851102640
numNetworkReqs1487528549185247
WebpackStandard HomeuiStartup------
load------
domContentLoaded------
domInteractive------
firstPaint------
backgroundConnect------
firstReactRender------
getState------
initialActions------
loadScripts------
setupStore------
numNetworkReqs------
WebpackPower User HomeuiStartup------
load------
domContentLoaded------
domInteractive------
firstPaint------
backgroundConnect------
firstReactRender------
getState------
initialActions------
loadScripts------
setupStore------
numNetworkReqs------
FirefoxBrowserifyStandard HomeuiStartup12051072168311912601431
load102492812627410821162
domContentLoaded102292812627410821162
domInteractive53311923077109
firstPaint------
backgroundConnect3419167203680
firstReactRender22183752235
getState1057110920
initialActions103112
loadScripts100391311636810601134
setupStore13592151350
numNetworkReqs1156615662
BrowserifyPower User HomeuiStartup26361777352829128323115
load12071012180816412331558
domContentLoaded12061012180816312321558
domInteractive14938744128159487
firstPaint------
backgroundConnect20729976233224804
firstReactRender81391301589104
getState27879848265263833
initialActions2014237
loadScripts1164980177615711801519
setupStore1291077919599744
numNetworkReqs97592164192207
WebpackStandard HomeuiStartup------
load------
domContentLoaded------
domInteractive------
firstPaint------
backgroundConnect------
firstReactRender------
getState------
initialActions------
loadScripts------
setupStore------
numNetworkReqs------
WebpackPower User HomeuiStartup------
load------
domContentLoaded------
domInteractive------
firstPaint------
backgroundConnect------
firstReactRender------
getState------
initialActions------
loadScripts------
setupStore------
numNetworkReqs------
📊 Page Load Benchmark Results

Current Commit: 0b22503 | Date: 11/20/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.11s (±121ms) 🟡 | historical mean value: 1.04s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 791ms (±117ms) 🟢 | historical mean value: 728ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 79ms (±12ms) 🟢 | historical mean value: 78ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.11s 121ms 1.02s 1.38s 1.33s 1.38s
domContentLoaded 791ms 117ms 704ms 1.04s 1.00s 1.04s
firstPaint 79ms 12ms 60ms 172ms 96ms 172ms
firstContentfulPaint 79ms 12ms 60ms 172ms 96ms 172ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

@MajorLift MajorLift force-pushed the jongsun/build/enable-react-compiler-webpack branch from 0b22503 to d9aa833 Compare November 20, 2025 20:35
@MajorLift
Copy link
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policy update failed. You can review the logs or retry the policy update here

@MajorLift MajorLift force-pushed the jongsun/build/enable-react-compiler-webpack branch from b9c8e5a to d0ea0c7 Compare November 21, 2025 17:53
@metamaskbot
Copy link
Collaborator

Builds ready [d0ea0c7]
UI Startup Metrics (1210 ± 88 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1210104514498812641383
load103490012238110831192
domContentLoaded102789312177910791183
domInteractive2414110172171
firstPaint55897122842210271173
backgroundConnect21219128513215232
firstReactRender30185393545
getState341476134158
initialActions108113
loadScripts822688102079882969
setupStore1162641222
numNetworkReqs1257720573
BrowserifyPower User HomeuiStartup18461521250825220342363
load99587716491639931459
domContentLoaded98086916191609761449
domInteractive38172204427170
firstPaint5278715643859061347
backgroundConnect22020226812225244
firstReactRender78471401682116
getState17212938149187268
initialActions105112
loadScripts77666914121597701246
setupStore20971112841
numNetworkReqs986920530107173
WebpackStandard HomeuiStartup839748103872884980
load62956783560639790
domContentLoaded62456382858635780
domInteractive241483152167
firstPaint23992778153224616
backgroundConnect1263881331
firstReactRender30214353439
getState28145293542
initialActions102111
loadScripts62156181856633771
setupStore1262541520
numNetworkReqs1257720573
WebpackPower User HomeuiStartup14451166210323915921950
load67358211101226931021
domContentLoaded66357610861216801011
domInteractive36151773931148
firstPaint2451031024149260616
backgroundConnect1475971724
firstReactRender7847116138898
getState15812227534168235
initialActions104112
loadScripts66057410721196781001
setupStore24973153755
numNetworkReqs1606830557203296
FirefoxBrowserifyStandard HomeuiStartup12181066171912512661506
load103592514628610841194
domContentLoaded103392514568610841194
domInteractive54281442972118
firstPaint------
backgroundConnect3621157223879
firstReactRender22183642233
getState95717819
initialActions103112
loadScripts101491014388110621159
setupStore116639931
numNetworkReqs1257117665
BrowserifyPower User HomeuiStartup27881993377239430143682
load12281024177419812241655
domContentLoaded12271024177319812241655
domInteractive15138663144154501
firstPaint------
backgroundConnect245271012275274862
firstReactRender86381542294133
getState25487897253204862
initialActions219227
loadScripts1185994173818911791610
setupStore13010827195126785
numNetworkReqs98532284395218
WebpackStandard HomeuiStartup14241248198613114761694
load12241070146010012881431
domContentLoaded12231070146010012871431
domInteractive62282253981135
firstPaint------
backgroundConnect39181462439109
firstReactRender27217492739
getState116143141021
initialActions102112
loadScripts1201105514249512711387
setupStore14523726941
numNetworkReqs1256516663
WebpackPower User HomeuiStartup27622015370337129893591
load14071153191118715551794
domContentLoaded14061152191118715541794
domInteractive13629640131151470
firstPaint------
backgroundConnect16522915176183644
firstReactRender81371562088121
getState24441894250218876
initialActions4053838
loadScripts13671105187118414981731
setupStore105678015897558
numNetworkReqs986522941101195
📊 Page Load Benchmark Results

Current Commit: d0ea0c7 | Date: 11/21/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±41ms) 🟡 | historical mean value: 1.05s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 734ms (±37ms) 🟢 | historical mean value: 731ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 79ms (±11ms) 🟢 | historical mean value: 80ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 41ms 1.02s 1.33s 1.09s 1.33s
domContentLoaded 734ms 37ms 707ms 997ms 769ms 997ms
firstPaint 79ms 11ms 60ms 168ms 88ms 168ms
firstContentfulPaint 79ms 11ms 60ms 168ms 88ms 168ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

@MajorLift MajorLift force-pushed the jongsun/build/enable-react-compiler-webpack branch from b571dfe to 92453b4 Compare November 21, 2025 18:39
@MajorLift MajorLift added the no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed label Nov 21, 2025
@MajorLift MajorLift marked this pull request as ready for review November 21, 2025 19:00
@MajorLift MajorLift requested review from a team as code owners November 21, 2025 19:00
Comment on lines 331 to 336
use: [
{
loader: reactCompilerLoader,
options: defineReactCompilerLoaderOption(reactCompilerOptions),
},
],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reactCompilerLoader is applied last, after codeFenceLoader and swcLoader.

  • Placing reactCompilerLoader before codeFenceLoader results in errors about /// END: directives not being found.
  • Placing it before swcLoader results in errors about input source maps not being found.

options: defineReactCompilerLoaderOption(reactCompilerOptions),
},
],
},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: React Compiler loader missing required loaders

The React Compiler loader rule only applies reactCompilerLoader without the preceding tsxLoader and codeFenceLoader that are necessary to process TypeScript and JSX syntax. According to the PR discussion, reactCompilerLoader must be applied after codeFenceLoader and swcLoader to avoid errors about missing directives and source maps. The current configuration will fail to properly transform files in the UI directory.

Fix in Cursor Fix in Web

Copy link
Contributor Author

@MajorLift MajorLift Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reactCompilerLoader is applied last.

  • The code-fence directives and input-source-map errors appear if I move reactCompilerLoader between swcLoader, codeFenceLoader in the use chains, or if I move the react compiler rule below the own-javascript/typescript rules.
  • I can verify that the UI files in the build are being correctly transformed.

@MajorLift
Copy link
Contributor Author

@metamaskbot update-policies

@MajorLift MajorLift force-pushed the jongsun/build/enable-react-compiler-webpack branch from b816440 to 659c749 Compare November 21, 2025 19:42
export const UI_DIR_RE = new RegExp(
`${join(__dirname, '../../../').replaceAll(sep, slash)}ui${slash}(?:components|contexts|hooks|layouts|pages)${slash}.*$`,
'u',
);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Missing path separator in UI directory regex

The UI_DIR_RE regex is missing a path separator between the project root and ui directory. The expression join(__dirname, '../../../') returns a path without a trailing separator, so concatenating it directly with ui${slash} creates an invalid pattern like /path/to/projectui/ instead of /path/to/project/ui/. This causes the regex to never match any files in the ui/ directory, preventing the React Compiler from being applied to UI components.

Fix in Cursor Fix in Web

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The opposite is true. Adding an extra slash breaks the regex. I triple-checked while writing this.

type: 'asset/resource',
},
{
test: /(?!\.(?:test|stories|container))\.(?:m?[jt]s|[jt]sx)$/u,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Regex fails to exclude test and story files

The negative lookahead in the test regex (?!\.(?:test|stories|container)) checks the position immediately before the file extension, not whether these patterns appear in the filename. For a file like Button.test.tsx, the lookahead checks if the position before .tsx is followed by .test, which it isn't (it's followed by .tsx), so the regex incorrectly matches. This causes the React Compiler to process test files, story files, and container files, which was explicitly intended to be excluded.

Fix in Cursor Fix in Web

Copy link
Contributor Author

@MajorLift MajorLift Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current regex is correct.

  • test, story etc. files are being excluded as intended.
  • The negative lookahead is supposed to only check the position immediately before the file extension.

@MajorLift MajorLift marked this pull request as draft November 21, 2025 20:14
@metamaskbot
Copy link
Collaborator

Builds ready [54d4402]
UI Startup Metrics (1283 ± 100 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup12831102157210013551468
load110193913119011641283
domContentLoaded109593413078911601277
domInteractive261483162469
firstPaint59087132244210971278
backgroundConnect22420026213230250
firstReactRender28196483045
getState341870124361
initialActions104112
loadScripts8787341084889481066
setupStore1242641323
numNetworkReqs1257921577
BrowserifyPower User HomeuiStartup18991590259725220942436
load1028907167016710431490
domContentLoaded1012897166016510211480
domInteractive38162204331173
firstPaint62810816014129591415
backgroundConnect22520427913232247
firstReactRender7848125128498
getState17413138539193244
initialActions104112
loadScripts80468514501638111272
setupStore201055102648
numNetworkReqs1106729846123210
WebpackStandard HomeuiStartup830740108574859997
load62657286163635790
domContentLoaded62256785563630783
domInteractive241496172279
firstPaint22676801164214643
backgroundConnect1163571030
firstReactRender30214563441
getState291463103644
initialActions104112
loadScripts61956584361627775
setupStore1273151422
numNetworkReqs1257720572
WebpackPower User HomeuiStartup14941239212924316762062
load69760711191237171046
domContentLoaded68560111071226971038
domInteractive39182334130152
firstPaint272891114195256663
backgroundConnect1584061828
firstReactRender8152117129099
getState16112631633171244
initialActions103012
loadScripts68259910981196951030
setupStore22982163057
numNetworkReqs1546631156198283
FirefoxBrowserifyStandard HomeuiStartup12501092157510713061482
load106493912977711231197
domContentLoaded106393912967711231196
domInteractive58311913180134
firstPaint------
backgroundConnect4018181244397
firstReactRender22183742236
getState1059391019
initialActions103112
loadScripts104192112727310941170
setupStore105417926
numNetworkReqs1256716660
BrowserifyPower User HomeuiStartup25661775352332327883065
load1173940161917312041556
domContentLoaded1172934161917312041556
domInteractive13833580123154456
firstPaint------
backgroundConnect16721770184195638
firstReactRender84401791990123
getState24939896259194851
initialActions3037538
loadScripts1132921160216611481505
setupStore102783216694686
numNetworkReqs89582124184209
WebpackStandard HomeuiStartup14421246207114414841774
load1231109515369812881450
domContentLoaded1231109515369812881450
domInteractive57251533282127
firstPaint------
backgroundConnect4317145234498
firstReactRender26207262833
getState116113121119
initialActions103122
loadScripts1206108215099212601403
setupStore155183251044
numNetworkReqs1256917664
WebpackPower User HomeuiStartup28442117383432230343495
load14021108199621315781834
domContentLoaded14011108199521315781834
domInteractive12929723145128525
firstPaint------
backgroundConnect15422711161199572
firstReactRender81381821988114
getState25282923260198884
initialActions3141438
loadScripts13641081195920915201812
setupStore1176775174112585
numNetworkReqs90622134383204
📊 Page Load Benchmark Results

Current Commit: 54d4402 | Date: 11/21/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±64ms) 🟡 | historical mean value: 1.05s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 730ms (±62ms) 🟢 | historical mean value: 731ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 77ms (±10ms) 🟢 | historical mean value: 80ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 64ms 1.01s 1.34s 1.25s 1.34s
domContentLoaded 730ms 62ms 700ms 1.03s 925ms 1.03s
firstPaint 77ms 10ms 60ms 156ms 88ms 156ms
firstContentfulPaint 77ms 10ms 60ms 156ms 88ms 156ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

@metamaskbot
Copy link
Collaborator

Builds ready [e790a49]
UI Startup Metrics (1230 ± 106 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup12301061166310612941398
load1058918151110311131215
domContentLoaded1051913146910111061206
domInteractive221478142068
firstPaint52984148041910351157
backgroundConnect2101932589213222
firstReactRender28194673144
getState341663114056
initialActions104113
loadScripts84666812551019011005
setupStore1252751424
numNetworkReqs1257821574
BrowserifyPower User HomeuiStartup18441530262726220152400
load1001873160214310311392
domContentLoaded986868159114110041374
domInteractive34161773429147
firstPaint52110116013889151288
backgroundConnect22119725113231248
firstReactRender7540116128194
getState17512935741189259
initialActions103011
loadScripts78167213801408031167
setupStore1910108122537
numNetworkReqs90671942998169
WebpackStandard HomeuiStartup8747651219979161077
load64659090964654814
domContentLoaded64158490163649806
domInteractive251685152364
firstPaint242108803161216636
backgroundConnect1364491233
firstReactRender3622323313643
getState321485133858
initialActions105113
loadScripts63858289161646796
setupStore1364351421
numNetworkReqs1257720571
WebpackPower User HomeuiStartup14341143215524015571981
load67758111931276991020
domContentLoaded66757411831276791012
domInteractive35161723628144
firstPaint2721101064197275652
backgroundConnect1473761727
firstReactRender764898108295
getState15712326935166239
initialActions103112
loadScripts66457211731246771002
setupStore22778153058
numNetworkReqs1486930456195288
FirefoxBrowserifyStandard HomeuiStartup12461066187314413151512
load105692212609011361221
domContentLoaded105492112609111361221
domInteractive59241573484137
firstPaint------
backgroundConnect3821339363896
firstReactRender23184862338
getState105939921
initialActions102122
loadScripts103590812318611061195
setupStore1267811938
numNetworkReqs1257317762
BrowserifyPower User HomeuiStartup27492056402738929233674
load1224983177519513631621
domContentLoaded1223983177519513631621
domInteractive15133653147165545
firstPaint------
backgroundConnect225191152273270900
firstReactRender86351662394133
getState22880893230179854
initialActions207127
loadScripts1176960173518612751576
setupStore1196786185123654
numNetworkReqs89552104285201
WebpackStandard HomeuiStartup14611271194013314981774
load1252108315569813151446
domContentLoaded1252108315559813141446
domInteractive59271753483133
firstPaint------
backgroundConnect4017129194387
firstReactRender25193932633
getState126148161216
initialActions103112
loadScripts1227106814789112921391
setupStore156168231171
numNetworkReqs1256616662
WebpackPower User HomeuiStartup29472241379929930983555
load14411103202520515781826
domContentLoaded14411103202520515781826
domInteractive13130623129145471
firstPaint------
backgroundConnect19229733192240656
firstReactRender86392082595131
getState30288940274429859
initialActions4069937
loadScripts13981085198220215351778
setupStore1207828182120659
numNetworkReqs89612134283204
📊 Page Load Benchmark Results

Current Commit: e790a49 | Date: 11/21/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±40ms) 🟡 | historical mean value: 1.05s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 721ms (±38ms) 🟢 | historical mean value: 731ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 77ms (±11ms) 🟢 | historical mean value: 80ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 40ms 1.01s 1.32s 1.06s 1.32s
domContentLoaded 721ms 38ms 701ms 997ms 740ms 997ms
firstPaint 77ms 11ms 60ms 172ms 92ms 172ms
firstContentfulPaint 77ms 11ms 60ms 172ms 92ms 172ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed size-S team-extension-platform Extension Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants