Skip to content

chore(deps): remove the fast-text-encoding polyfill - #21028

Open
vbudhram wants to merge 1 commit into
mainfrom
fxa-13921
Open

chore(deps): remove the fast-text-encoding polyfill#21028
vbudhram wants to merge 1 commit into
mainfrom
fxa-13921

Conversation

@vbudhram

Copy link
Copy Markdown
Contributor

Because

  • TextEncoder and TextDecoder are globals in every Node and browser target FxA supports, so the fast-text-encoding polyfill never loads.
  • The import only ran for its side effect. Nothing in the repo imports a name from it.

This pull request

  • Removes the typeof TextEncoder === 'undefined' guard and its dynamic import from AuthClient.create in client.ts.
  • Removes the fast-text-encoding resolve alias from webpack.config.js.
  • Drops fast-text-encoding and @types/fast-text-encoding from the fxa-auth-client and fxa-content-server manifests, and updates yarn.lock to match.

Issue that this pull request solves

Closes: https://mozilla-hub.atlassian.net/browse/FXA-13921

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).
  • I have manually reviewed all AI generated code.

How to review (Optional)

  • Key files/areas to focus on: AuthClient.create in packages/fxa-auth-client/lib/client.ts.
  • Suggested review order: client.ts, then the webpack alias, then the two manifests and the lockfile.
  • Risky or complex parts: the published-package note below. The premise that TextEncoder exists in all supported targets is the reviewer's to confirm.

Screenshots (Optional)

Other information (Optional)

packages/fxa-auth-client publishes to npm, so third parties consume it. Today, on an environment with no global TextEncoder, AuthClient.create() recovers by loading the polyfill. After this change it does not, and such a consumer fails later inside checkWebCrypto or during key derivation. Nothing replaces the guard, since the ticket asks for removal rather than a substitute. No exported signature moves, so this is not an API change.

Verified locally: nx lint fxa-auth-client and nx lint fxa-content-server pass, tsc -p packages/fxa-auth-client/tsconfig.json --noEmit is clean, and the fxa-auth-client unit suite passes (47 tests). No tests were added or changed. Functional tests were not run.

Copilot AI balanced review requested due to automatic review settings August 13, 2026 18:55
@vbudhram
vbudhram requested a review from a team as a code owner August 13, 2026 18:55
@vbudhram vbudhram added the auto label Aug 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Removes an obsolete text-encoding polyfill from the FxA auth client and legacy content server.

Changes:

  • Removes conditional polyfill loading from AuthClient.create.
  • Removes the webpack alias and package dependencies.
  • Updates the lockfile accordingly.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/fxa-auth-client/lib/client.ts Removes dynamic polyfill loading.
packages/fxa-auth-client/package.json Drops polyfill packages.
packages/fxa-content-server/package.json Drops the runtime dependency.
packages/fxa-content-server/webpack.config.js Removes the obsolete alias.
yarn.lock Removes dependency resolutions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants