Skip to content

Conversation

@Lemonexe
Copy link
Contributor

@Lemonexe Lemonexe commented Nov 19, 2025

Description

After bumping node to 24 in #23206, all our CJS–ESM pains have been washed away, magically solved in nodeJS nodejs/node#51977, so now everything will be 🌈 and 🦄 ❤️

Problems were mainly in these domains:

  • electron-main
  • playwright test runtime (not to be confused with the tested app, which runs in browser)
    • FYI: we don't transpile or bundle our test runtime files, because playwright has a TS loader, something like tsx, so we're loading TS files, which are written in ES, but the TS loader transpiles them on the fly to execute them in nodeJS in CJS mode
    • executing test files that import ESM only packages was not possible until node 24, now it just works 🎉
  • jest easily solvable by babel using this approach. This is already done a lot in mobile..
    • Note that this is nothing new, we could have done this always
  • metro, not really solved, just hacked 😕

And so I bumped all packages that were considered blocked:

  • electron-store (electron-main)
  • @noble/curves (electron-main, playwright)
  • uuid (playwright)
  • chalk (electron-main, some scripts)

QA instructions

desktop builds here

Suite Desktop: on Win, macOS, Linux, test that these settings are correctly persisted (electron-store):

  • ℹ️ just FYI: electron-store is not the primary storage of userdata, that's IDB which is both for Web & Desktop. Only some specific data that are related to Desktop app behavior in relation to OS are stored in electron-store
  • Need to test at least some of the settings, that they are correctly persisted after app relaunch
    • window size
    • biometric authentication enabled/disabled
    • tor enabled/disabled
    • bridge choice
    • theme choice

Suite Desktop, Web, Android, iOS (@noble/curves)

  • device authenticity check, please test production TS7 on
  • evolu getProofOfDelegatedIdentity how to test??

Also uuid: Not much to test, it's a tiny utility hidden beneath. Testable is only desktop/web Message system manager (correctly generates random uuid).

And some CI scripts which I have all tested:

yarn check-workspace-resolutions
yarn workspace @suite-common/icons generate-icons
yarn update-project-references
yarn generate-package @suite-common/blabla

And green CI means Playwright and Jest is OK 💚

Related issue

Resolve #22316
Resolve #14482

Notes

Actually, this nodeJS feature was even backported to 22.12, so we could have done it much sooner 🤦 But we were staying on 22.11 for the past year, and I only realized that now.. This is however highly relevant for electron-main, because electron-main environemnt is driven by electron, not by our repo. Electron ships with node 22.20 as of 39. That's why I electron store can be loaded in CJS mode, and again, it's something I could have done sooner, probably at electron 35?

Note that long-term, we might still want to bundle our Electron-main script as ESM, and run it as such. That would require abandoning webpack in electron-main, probably rollup instead. But it's not so hot now..

🔍🖥️ Suite desktop test results: View in Currents

🔍🖥️ Suite web test results: View in Currents

🔍🖥️ Suite native android test results: View in Currents

@Lemonexe Lemonexe added dependencies Pull requests that update a dependency file no-project This label is used to specify that PR doesn't need to be added to a project labels Nov 19, 2025
@trezor-bot
Copy link
Contributor

trezor-bot bot commented Nov 19, 2025

✅ Previously successful run of [Test] PR Suite Desktop e2e tests workflow has been found.
⏭️ Skipping tests for this run.
💡 If you are unsure about your latest changes, please rerun the workflow manually. (Use the Re-run all jobs option)

@trezor-bot
Copy link
Contributor

trezor-bot bot commented Nov 19, 2025

✅ Previously successful run of [Test] PR Suite Web e2e tests workflow has been found.
⏭️ Skipping tests for this run.
💡 If you are unsure about your latest changes, please rerun the workflow manually. (Use the Re-run all jobs option)

@Lemonexe Lemonexe marked this pull request as ready for review November 19, 2025 22:01
filePath: require.resolve(rootNodeModulesPath + '/uuid/dist/index.js'),
type: 'sourceFile',
};
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Otherwise you get

Android Bundling failed 47120ms suite-native/app/index.js (8598 modules)
Unable to resolve "uuid" from "suite-common/message-system/src/messageSystemUtils.ts"

Copy link
Contributor

Choose a reason for hiding this comment

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

image

@Lemonexe Lemonexe marked this pull request as draft November 19, 2025 22:09
@Lemonexe Lemonexe force-pushed the chore/bump-uuid branch 3 times, most recently from 2c2b4f1 to eb5abfb Compare November 20, 2025 21:14
@Lemonexe Lemonexe changed the title chore: bump uuid chore: bump deps blocked by ESM Nov 20, 2025
@Lemonexe Lemonexe marked this pull request as ready for review November 20, 2025 21:16
@Lemonexe Lemonexe requested a review from karliatto as a code owner November 20, 2025 21:16
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

deleting this effectively means changing to module: ESNext and moduleResolution: nodenext
(inheriting from tsconfig.base.json)

I don't know for what historical reason was it necessary to specify CJS module resolution for typescript, but now it isn't, because /src si bundled and /e2e is loaded via playwright typescript loader, which resolves ESM and CJS mostly quite well.

'\\.(js|jsx|ts|tsx)$': ['babel-jest', babelConfig],
},

transformIgnorePatterns: ['node_modules/?!(\\@noble)/'],
Copy link
Contributor Author

@Lemonexe Lemonexe Nov 21, 2025

Choose a reason for hiding this comment

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

this couldn't have worked, because node_modules/\@noble does not exist,
so the ?! would never match
so the pattern would never match
so all node_modules would be ignored from babel transform = same as default.

Well, this means it was not needed 🙂

modulePathIgnorePatterns: ['node_modules', '<rootDir>/lib', '<rootDir>/libDev'],
watchPathIgnorePatterns: ['<rootDir>/libDev', '<rootDir>/lib'],
testPathIgnorePatterns: ['<rootDir>/libDev/', '<rootDir>/lib/'],
transformIgnorePatterns: ['/node_modules/'],
Copy link
Contributor Author

@Lemonexe Lemonexe Nov 21, 2025

Choose a reason for hiding this comment

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

superfluous; this is the default. Deleting this line so it uses the default in jest.base.config.js

@Lemonexe Lemonexe added this to Suite Nov 21, 2025
@Lemonexe Lemonexe removed the no-project This label is used to specify that PR doesn't need to be added to a project label Nov 21, 2025
@Lemonexe Lemonexe moved this to 🔎 Needs review in Suite Nov 21, 2025
Copy link
Contributor

@peter-sanderson peter-sanderson left a comment

Choose a reason for hiding this comment

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

gigachad 🐶

@Lemonexe Lemonexe merged commit c1b8a26 into develop Nov 21, 2025
37 checks passed
@Lemonexe Lemonexe deleted the chore/bump-uuid branch November 21, 2025 17:15
@github-project-automation github-project-automation bot moved this from 🔎 Needs review to 🤝 Needs QA in Suite Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

Status: 🤝 Needs QA

Development

Successfully merging this pull request may close these issues.

Playwright ESM Electron-main ESM

3 participants