Reduce Medusa admin build load#398
Conversation
Changed Files
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughUpgrades Vite and related tooling, pins nested dependencies via pnpm overrides, changes Medusa admin allowed-hosts derivation to parse/trim MEDUSA_BACKEND_URL, and simplifies the MDXEditor by removing code-mirror/diff features and toolbar controls. ChangesVite 8 Upgrade and MDXEditor Simplification
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 41607a8aa8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Blacksmith Account SuspendedThis Blacksmith account requires additional verification. Jobs targeting Blacksmith runners will not be picked up and will remain queued until they timeout. Please contact Blacksmith Support for assistance. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f39662bb0f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 33c3cf7b5d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6e39e1b206
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/medusa-be/medusa-config.ts`:
- Around line 47-50: The catch block for setting MEDUSA_ADMIN_ALLOWED_HOSTS can
pass a full URL string to allowedHosts; update the catch to extract a hostname
from MEDUSA_BACKEND_URL consistently (e.g., construct a URL with a scheme like
`http://` around MEDUSA_BACKEND_URL and use its hostname) so
MEDUSA_ADMIN_ALLOWED_HOSTS always receives a bare hostname; change only the
fallback assignment for MEDUSA_ADMIN_ALLOWED_HOSTS while keeping the try branch
that uses new URL(MEDUSA_BACKEND_URL).hostname.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: f40090ad-a508-474c-9d65-b0741ea4a2f2
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (6)
apps/frontend-demo/package.jsonapps/medusa-be/medusa-config.tsapps/n1/package.jsonapps/payload/package.jsonapps/payload/vitest.config.mtspackage.json
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: main
🧰 Additional context used
📓 Path-based instructions (7)
**/package.json
📄 CodeRabbit inference engine (CLAUDE.md)
Use pnpm CLI to add dependencies; never edit package.json directly
Files:
apps/frontend-demo/package.jsonapps/n1/package.jsonpackage.jsonapps/payload/package.json
apps/n1/**/package.json
📄 CodeRabbit inference engine (apps/n1/CLAUDE.md)
Do NOT manually edit
package.json- usepnpm add <pkg>orpnpm add -D <pkg>commands instead
Files:
apps/n1/package.json
apps/payload/**/package.json
📄 CodeRabbit inference engine (apps/payload/.cursor/rules/components.md)
Pin all
@payloadcms/* packages to the exact same version to avoid dependency version mismatch errors with hooks like useConfig
Files:
apps/payload/package.json
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Import UI components using the pattern
import { ComponentName } from '@libs/ui/atoms/component-name'or'@libs/ui/molecules/component-name'
Files:
apps/medusa-be/medusa-config.ts
apps/medusa-be/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (apps/medusa-be/CLAUDE.md)
apps/medusa-be/**/*.{ts,tsx,js,jsx}: Always use braces for if/else statements, even for single statements
Declare one variable per const/let statement; do not use multiple declarations on one line
Use nullish coalescing operator (??) instead of logical OR (||) for null/undefined defaults
Write comments explaining why code exists, not what it does; rely on self-documenting code with clear naming
Always validate data before type casting; do not use 'as Type' without prior validation
Files:
apps/medusa-be/medusa-config.ts
apps/medusa-be/**/*.{ts,tsx}
📄 CodeRabbit inference engine (apps/medusa-be/CLAUDE.md)
apps/medusa-be/**/*.{ts,tsx}: Do not use non-null assertion operator (!) in TypeScript code
Annotate the type of generic field access (e.g., result[field]) as unknown before type guards
Use Modules.* and ContainerRegistrationKeys.* constants instead of hardcoding strings for container resolution
Files:
apps/medusa-be/medusa-config.ts
apps/medusa-be/**/medusa-config.ts
📄 CodeRabbit inference engine (apps/medusa-be/CLAUDE.md)
apps/medusa-be/**/medusa-config.ts: Conditional module loading must be evaluated at BUILD time via environment variables, not runtime
Cross-module provider dependencies must declare 'dependencies' array in module config for injection into provider container
Files:
apps/medusa-be/medusa-config.ts
🧠 Learnings (2)
📚 Learning: 2026-02-05T14:43:17.404Z
Learnt from: KaiUweCZE
Repo: NMIT-WR/new-engine PR: 324
File: apps/medusa-be/package.json:0-0
Timestamp: 2026-02-05T14:43:17.404Z
Learning: Validate and enforce React 19 compatibility across monorepo workspaces. Since Medusa UI supports React 19 via root package.json overrides and Medusa Cloud prerequisites show React 19 overrides for npm workspaces, ensure workspace root and all relevant package.json files align with React 19 (18+ requirement is satisfied). When reviewing, verify that overrides exist in the root package.json and that dependent packages in apps or packages directories declare React 19 (or compatible) in their peerDependencies or dependencies as appropriate for workspace usage.
Applied to files:
apps/frontend-demo/package.jsonapps/n1/package.jsonpackage.jsonapps/payload/package.json
📚 Learning: 2026-05-07T19:05:58.339Z
Learnt from: redeyecz
Repo: TechsioCZ/new-engine PR: 390
File: apps/medusa-be/package.json:78-81
Timestamp: 2026-05-07T19:05:58.339Z
Learning: When reviewing changes to `package.json`, do not automatically flag dependency additions/removals as "manually edited" or as "bypassing the pnpm lockfile" just because the `package.json` diff shows only that file changed. First verify whether `pnpm-lock.yaml` is missing the corresponding entries. Since `pnpm add` updates both `package.json` and `pnpm-lock.yaml` together, legitimate changes can appear in the `package.json` diff while still being properly tracked in the lockfile.
Applied to files:
apps/frontend-demo/package.jsonapps/n1/package.jsonpackage.jsonapps/payload/package.json
🔇 Additional comments (5)
package.json (1)
52-56: chore: Vite/admin override pinning looks consistentThe targeted and global
vitepins are coherent and reduce resolver drift across workspaces.apps/frontend-demo/package.json (1)
37-37: chore: Node typings bump is aligned
@types/nodeupdate is straightforward and consistent with the broader toolchain alignment in this PR.apps/n1/package.json (1)
39-39: chore: typings alignment in n1 is goodThis pin keeps the app’s TS node typings in step with the related workspace updates.
apps/payload/package.json (1)
46-58: chore: Payload test stack upgrade is coherentThe Vite 8 / Vitest 4 / plugin-react 6 combination and Node engine floor update are consistent with the intended migration path.
Also applies to: 61-61
apps/payload/vitest.config.mts (1)
5-8: chore: config simplification is cleanSwitching to built-in tsconfig path resolution and keeping a minimal plugin list improves maintainability without changing test intent.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fb265a2dca
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary
minify: falseworkaround stays removedvite@8.0.11throughpnpm.overrides, so workspace Vite resolutions do not drift back to Vite 5/7@medusajs/admin-bundler,@medusajs/admin-vite-plugin, and@vitejs/plugin-react@6.0.1vite@8.0.11,@vitejs/plugin-react@6.0.1,vitest@4.1.5, and native Vite 8resolve.tsconfigPathsNotes
minimum-release-age=1440policy. The lockfile pinsvite@8.0.11, andpnpm fetch --frozen-lockfilepasses without changing repo policy.pnpmstill reports existing unrelated peer warnings around Medusa/plugin packages, but the Docker build validates that the admin build works with the forced Vite 8 path.Validation
bunx biome check --write package.json apps/frontend-demo/package.json apps/n1/package.json apps/payload/package.json apps/payload/vitest.config.mtsbunx biome check --write apps/medusa-be/medusa-config.ts apps/medusa-be/src/admin/widgets/product-description-editor.tsxpnpm list -r vite --depth 0-> onlyvite@8.0.11rg -n 'vite@([0-7]\\.|9\\.)|\\bvite: ["'"'"'^~]*[0-7]\\.|"vite"\\s*:\\s*"[~^]?[0-7]\\.' pnpm-lock.yaml package.json apps libs --glob 'package.json'-> no matchespnpm --filter @nmit/payload test:int-> 9 files / 109 tests passedpnpm fetch --store-dir=/tmp/new-engine-pnpm-fetch-vite8 --frozen-lockfile-> passed without min-age bypassgit diff --check/usr/bin/time -l docker build --progress=plain --target build -f docker/development/medusa-be/Dockerfile .pnpm fetch --frozen-lockfilepassedSummary by CodeRabbit