chore: replace uuid with native crypto.randomUUID()#1866
Merged
Conversation
The uuid package was used in exactly one place (an E2E test) to generate a unique post title. Node 22 (and all modern browsers) ship crypto.randomUUID() natively, so the dependency is unnecessary. Also unblocks XWPENG-29: uuid v14 dropped CJS exports, which broke eslint-plugin-import's resolver chain (eslint-import-resolver-node 0.3.9 does not understand ESM-only "exports" maps). Removing uuid avoids needing to upgrade the resolver chain. Refs XWPENG-29 Supersedes #1861
This was referenced May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes the
uuiddevDependency in favour of the built-incrypto.randomUUID().Why
uuidwas used in exactly one place (tests/e2e/editor-new-post.spec.js) to generate a unique post title for a Playwright test.Node 22+ and all modern browsers expose
crypto.randomUUID()globally β no dependency required.Unblocks chore(deps): update dependency uuid to v14Β #1861 / XWPENG-29:
uuidv14 ships ESM-only (drops therequireexport condition). The currently bundledeslint-import-resolver-node@0.3.9(transitively via@wordpress/eslint-plugin@22.22.0) doesn't understand theexportsfield, sonpm run lint:jsfails with:Removing
uuidsidesteps the resolver upgrade entirely.Changes
package.json: removed"uuid": "^11.1.1"fromdevDependencies.package-lock.json: regenerated;uuidentry dropped.tests/e2e/editor-new-post.spec.js: removedimport { v4 as uuidv4 } from 'uuid'; replaceduuidv4()withcrypto.randomUUID().Verification
npm ciβ OKnpm run lint:jsβ cleannpm run buildβ OK;build/select2/*andbuild/timeago/*assets presentnode -e "console.log(crypto.randomUUID())"β OK on Node 22Related