admin-no-medusa-utils-import - ESLint plugin rules

This rule disallows importing Node-only modules from the Medusa Framework (@medusajs/framework/utils, @medusajs/framework/http, and @medusajs/framework/workflows-sdk) in admin code, since they break the browser bundle.

Severity#

error. This rule is enabled in the recommended preset.

What it Targets#

This rule targets files in your project's src/admin directory. It reports an import or re-export of a Node-only module from the Medusa Framework.

The following code is reported by the rule:

src/admin/widgets/product-widget.tsx
import { MedusaError } from "@medusajs/framework/utils"

Instead, move the logic to the server and call it from the admin via the JS SDK:

src/admin/widgets/product-widget.tsx
import { sdk } from "../lib/sdk"

Why it's Important#

The admin dashboard is a browser bundle. Importing Node-only modules breaks the admin build or ships server-only code to the client.

Learn more in the Admin Development documentation.

Fixable#

This rule isn't auto-fixable.

Was this page helpful?
Ask Bloom
For assistance in your development, use Claude Code Plugins or Docs MCP server in Cursor, VSCode, etc...FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break
⇧↵