Shorten minified error URL to reduce production bundle size#4677
Conversation
🦋 Changeset detectedLatest commit: ed467aa The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
ecbfe95 to
58358d3
Compare
58358d3 to
7f4b968
Compare
aea90a7 to
620da5b
Compare
| const { relative, resolve } = require("path") | ||
|
|
||
| const repoRoot = resolve(__dirname, "../..") | ||
| const errorsPath = resolve(repoRoot, "packages/mobx/src/errors.ts") |
There was a problem hiding this comment.
@mweststrate the change was merged but it doesn't seem to be deploying to prod. I can’t see the logs, but my suspicion is that the Node version is outdated wherever we build the docs.
Node 24 locally imports the errors.ts correctly. An older version would fail. I'd appreciate if you could update it there!
There was a problem hiding this comment.
Pull request overview
This PR adds an always-up-to-date documentation page for MobX production error codes and updates the minified-error message to point to a shorter URL, aiming to reduce the production bundle size.
Changes:
- Add an error-codes doc page entry to the Docusaurus sidebar + i18n.
- Generate
docs/errors.mdautomatically before starting/building the website. - Shorten the production “minified error” URL in
die().
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| website/sidebars.json | Adds the new errors doc to the sidebar navigation. |
| website/scripts/generate-error-docs.js | New script intended to generate docs/errors.md from MobX source errors. |
| website/package.json | Runs the generator on prestart and prebuild. |
| website/i18n/en.json | Adds title/sidebar labels for the new errors doc. |
| packages/mobx/src/internal.ts | Stops re-exporting everything from ./errors (exports only die). |
| packages/mobx/src/errors.ts | Exports niceErrors and updates the production minified-error link text. |
| .gitignore | Ignores the generated docs/errors.md. |
| .changeset/fix-minified-error-link.md | Adds a patch changeset entry for the link change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Added a separate documentation page for the production error codes we have. Benefits:
mobx.js.org/errorsin the production bundle since gzip does not shorten unique stringsThe page will be always up-to-date with the source code