Page MenuHomePhabricator

Upgrade GrowthExperiments extension to node16
Open, MediumPublic

Description

According to T431855: node10 warning in GrowthExperiments extension, the extension needs to be updated from node10 to node16

Event Timeline

VadymTS1 triaged this task as Medium priority.
Anirudh_KK added a project: RoadToWiki.

I'll take this on. Assigning to myself. Planning to upgrade GrowthExperiments from node10 to node16 as discussed on T431855 — will update here with progress and flag anything that comes up

Change #1310557 had a related patch set uploaded (by Anirudh_K; author: Anirudh_K):

[mediawiki/extensions/GrowthExperiments@master] GrowthExperiments: Update the extension from node10 to node16

https://gerrit.wikimedia.org/r/1310557

I have submitted a patch to upgrade the extension's TypeScript configuration from the deprecated node10 strategy to modern standards.
When attempting to strictly use "moduleResolution": "node16", TypeScript forces Node.js CommonJS rules and throws TS1479 errors when importing Vite (which is an ES Module). To implement this properly for a Vite project without having to rewrite the extension's file structure to .mts, I updated the module resolution to "bundler".
Supporting "bundler" module resolution required bumping the TypeScript dependency to ^5.7.3 and making three very minor type adjustments caught by the newer compiler such as defining CSS imports and fixing a Vite plugin return type.
Local tests (npm run test:types) pass successfully with this modern configuration. Looking forward to your review!

@EMcFarland-WMF Can you or someone review related patch?

@EMcFarland-WMF Just checking in on this! The patch to upgrade to node16 is ready for a look whenever someone has a moment. Let me know if any changes are needed.

Change #1310557 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] GrowthExperiments: Update typescript from 4.9 to 5.7

https://gerrit.wikimedia.org/r/1310557