Skip to content

Fix build script for WF docs; correct content issues - #10412

Merged
mcmire merged 1 commit into
mainfrom
get-wallet-framework-docs-to-build
Sep 24, 2026
Merged

mcmire merged 1 commit into
mainfrom
get-wallet-framework-docs-to-build

Conversation

@mcmire

@mcmire mcmire commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Explanation

This commit fixes a couple of related issues with the wallet-framework-docs package:

Build issues

Running the dev or build package scripts under @metamask/wallet-framework-docs stopped working after the ESM migration. It seems that Docusaurus — or Docusaurus's usage of Webpack — is not fully compatible with ESM, as it produces the following error:

[ERROR] Error: Unable to build website for locale en.
    at tryToBuildLocale (~/core/node_modules/@docusaurus/core/lib/commands/build/build.js:76:15)
    at async ~/core/node_modules/@docusaurus/core/lib/commands/build/build.js:34:9
    at async mapAsyncSequential (~/core/node_modules/@docusaurus/utils/lib/jsUtils.js:21:24)
    at async Command.build (~/core/node_modules/@docusaurus/core/lib/commands/build/build.js:33:5)
    at async Promise.all (index 0)
    at async runCLI (~/core/node_modules/@docusaurus/core/lib/commands/cli.js:56:5)
    at async file://~/core/node_modules/@docusaurus/core/bin/docusaurus.mjs:44:3 {
  [cause]: TypeError: require.resolveWeak is not a function
      at 9219 (server.bundle.js:30913:17)
      at __webpack_require__ (server.bundle.js:31109:31)
      at 8672 (server.bundle.js:20639:57)
      at __webpack_require__ (server.bundle.js:31109:31)
      at 6658 (server.bundle.js:30990:66)
      at __webpack_require__ (server.bundle.js:31109:31)
      at 7856 (server.bundle.js:21514:55)
      at __webpack_require__ (server.bundle.js:31109:31)
      at 5976 (server.bundle.js:21643:46)
      at __webpack_require__ (server.bundle.js:31109:31)
}

To fix this, I've removed "type": "module" from wallet-framework-docs so it is no longer ESM-only. Right now, that doesn't cause any issues because the package is private. If we end up publishing this package for any reason, we'll need to figure out a different solution, but this solves the problem for now.

Making that change forced me to make an exception for wallet-framework-docs in the Yarn constraints.

Note

platform-api-docs also uses Docusaurus, but unexplicably, running yarn docs:platform-api:build seems to work just fine.

Content issues

Since we don't try to build wallet-framework-docs in CI, some of the links in the docs were broken and we didn't know about them. I've fixed them in this commit, too.

Manual testing steps

  • Run yarn workspace @metamask/wallet-framework-docs run dev. It should not produce any errors.
  • Run yarn workspace @metamask/wallet-framework-docs run build. It should not produce any errors.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Low Risk
Documentation package manifest, constraint exception, and internal doc links only; no runtime wallet or API behavior changes.

Overview
Restores @metamask/wallet-framework-docs dev/build after the monorepo ESM migration by removing "type": "module" from that package’s package.json, avoiding Docusaurus/Webpack failures (require.resolveWeak is not a function).

Yarn constraints now skip the global type: module requirement for DOCSITE_PACKAGES (currently only @metamask/wallet-framework-docs), with a comment noting Docusaurus’s ESM limitations.

Writing Data Services tutorial links are updated to Docusaurus-style paths (./getting-started/, ./read-only-requests/ and ../getting-started/) instead of numbered relative paths that were broken when the site wasn’t built in CI.

Reviewed by Cursor Bugbot for commit ee51e26. Bugbot is set up for automated code reviews on this repo. Configure here.

This commit fixes a couple of related issues with the
`wallet-framework-docs` package:

\## Build issues

Running the `dev` or `build` package scripts under
`@metamask/wallet-framework-docs` stopped working after the ESM
migration. It seems that Docusaurus — or Docusaurus's usage of Webpack —
is not fully compatible with ESM, as it produces the following error:

```
[ERROR] Error: Unable to build website for locale en.
at tryToBuildLocale (~/core/node_modules/@docusaurus/core/lib/commands/build/build.js:76:15)
at async ~/core/node_modules/@docusaurus/core/lib/commands/build/build.js:34:9
at async mapAsyncSequential (~/core/node_modules/@docusaurus/utils/lib/jsUtils.js:21:24)
at async Command.build (~/core/node_modules/@docusaurus/core/lib/commands/build/build.js:33:5)
at async Promise.all (index 0)
at async runCLI (~/core/node_modules/@docusaurus/core/lib/commands/cli.js:56:5)
at async file://~/core/node_modules/@docusaurus/core/bin/docusaurus.mjs:44:3 {
[cause]: TypeError: require.resolveWeak is not a function
at 9219 (server.bundle.js:30913:17)
at __webpack_require__ (server.bundle.js:31109:31)
at 8672 (server.bundle.js:20639:57)
at __webpack_require__ (server.bundle.js:31109:31)
at 6658 (server.bundle.js:30990:66)
at __webpack_require__ (server.bundle.js:31109:31)
at 7856 (server.bundle.js:21514:55)
at __webpack_require__ (server.bundle.js:31109:31)
at 5976 (server.bundle.js:21643:46)
at __webpack_require__ (server.bundle.js:31109:31)
}
```

To fix this, I've removed `"type": "module"` from
`wallet-framework-docs` so it is no longer ESM-only. Right now, that
doesn't cause any issues because the package is private. If we end up
publishing this package for any reason, we'll need to figure out a
different solution, but this solves the problem for now.

Making that change forced me to make an exception for
`wallet-framework-docs` in the Yarn constraints.

> [!NOTE]
> `platform-api-docs` also uses Docusaurus, but unexplicably, running
> `yarn docs:platform-api:build` seems to work just fine.

\## Content issues

Since we don't try to build `wallet-framework-docs` in CI, some of the
links in the docs were broken and we didn't know about them. I've fixed
them in this commit, too.
@mcmire
mcmire force-pushed the get-wallet-framework-docs-to-build branch from 32b6fe0 to ee51e26 Compare September 24, 2026 18:22
@mcmire mcmire changed the title WF docs: Fix building & move Docusaurus scripts under 'site:' Fix build script for wallet-framework-docs, correct content issues Sep 24, 2026
@mcmire mcmire changed the title Fix build script for wallet-framework-docs, correct content issues Fix build script for WF docs; correct content issues Sep 24, 2026
@mcmire
mcmire marked this pull request as ready for review September 24, 2026 18:37
@mcmire
mcmire requested a review from a team as a code owner September 24, 2026 18:37
@mcmire
mcmire deployed to default-branch September 24, 2026 18:37 — with GitHub Actions Active

@Mrtenz Mrtenz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That's weird. 😕 The Docusaurus CLI itself is ESM. But I don't see a good alternative here.

@mcmire
mcmire added this pull request to the merge queue Sep 24, 2026
Merged via the queue into main with commit 0b8c1b4 Sep 24, 2026
341 checks passed
@mcmire
mcmire deleted the get-wallet-framework-docs-to-build branch September 24, 2026 18:57

This branch was successfully deployed

1 active deployment
default-branch — ee51e269 Deployed Sep 24, 2026 by mcmire via Determine whether this PR is a release PR #4618
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants