github medusajs/medusa v2.0.0-rc
Medusa 2.0 Release Candidate #1

17 hours ago

We’re excited to share the first Release Candidate (RC) of Medusa 2.0. By definition, release candidates are not production-ready. There are likely still minor issues across our packages, which is part of the reason for publishing a pre-release of the official version.

We welcome feedback, questions, and bug reports. Please use Issues to submit your input.

Get started with a new project

To get started using the RC, run the following command:

npx create-medusa-app@rc

This command will create a new Medusa project with our redesigned admin and a 2.0-compatible Next.js storefront. The Medusa application and the Next.js storefront are separate projects in separate folders.

Highlights

Please note, the following highlights are based on changes that have landed between the last preview release update and this release candidate.

We will cover all new changes to Medusa 2.0 in the official release notes. For now, you can refer to previous preview release updates to see what's new.

Package restructuring

Warning

Breaking change

With the announcement of the first Release Candidate, we decided to perform some housekeeping tasks and arrange our packages/dependencies. This is the last larger breaking change before the official release of 2.0.

Our goal with this change is to reduce the footprint of multiple packages within your application. Instead, we expose all the core-level utilities via the @medusajs/framework package and all commerce features via the @medusajs/medusa package.

As a result, you will have fewer dependencies to install and upgrade with every change. We will also be able to restructure things internally without impacting outside usage.

Dependencies

Moving forward, the dependencies inside a fresh Medusa application's package.json file will look as follows:

{
  "dependencies": {
    "@medusajs/admin-sdk": "rc",
    "@medusajs/framework": "rc",
    "@medusajs/medusa": "rc",
    "@medusajs/medusa-cli": "rc",

    "@mikro-orm/core": "5.9.7",
    "@mikro-orm/knex": "5.9.7",
    "@mikro-orm/migrations": "5.9.7",
    "@mikro-orm/postgresql": "5.9.7",
    "awilix": "^8.0.1",
    "pg": "^8.13.0"
  },
  "devDependencies": {
    "@mikro-orm/cli": "5.9.7",
   
    "@swc/jest": "^0.2.36",
    "medusa-test-utils": "rc",
    "jest": "^29.7.0",

    "@types/node": "^20.0.0",
    "@swc/core": "1.5.7",
    "ts-node": "^10.9.2",
    "typescript": "^5.6.2",

    "@types/react": "^18.3.2",
    "@types/react-dom": "^18.2.25",
    "prop-types": "^15.8.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "vite": "^5.2.11"
  },
}

You don't have to install individual modules since they are all bundled and distributed via the @medusajs/medusa package.

TSConfig file changes

Now that most packages have been bundled into @medusajs/medusa and `@medusajs/framework, importing from the transitive dependencies should be done with subpaths.

For example, this is how a link definition will look like:

import HelloModule from "../modules/hello"
- import ProductModule from "@medusajs/product"
+ import ProductModule from "@medusajs/medusa/product"
- import { defineLink } from "@medusajs/utils"
+ import { defineLink } from "@medusajs/framework/utils"

export default defineLink(
  ProductModule.linkable.product,
  HelloModule.linkable.myCustom
)

In the above example, we import the product module from the @medusajs/medusa/product subpath and the defineLink from the @medusajs/framework/utils subpath.

To use subpath imports, the moduleResolution should be set to Node16 inside the tsconfig.json file:

{
  "module": "Node16",
  "moduleResolution": "Node16",
}

medusa-config.js file changes

With the introduction of subpath imports, the module registration in medusa-config.js should similarly use subpaths instead of top-level paths.

For example, this is how you would register the authentication module:

defineConfig({
  // ...
  modules: {
-  resolve: "@medusajs/auth",
+  resolve: "@medusajs/medusa/auth",
    options: {
      providers: [
        {
-         resolve: "@medusajs/auth-emailpass",
+         resolve: "@medusajs/medusa/auth-emailpass",
          id: "emailpass",
          options: {
            // provider options...
          },
        },
      ],
    },
  },
})

Notice the change from @medusajs/auth to @medusajs/medusa/auth and @medusajs/auth-emailpass to @medusajs/medusa/auth-emailpass.

Features

Bugs

Documentation

Chores

Other Changes

New Contributors

Full Changelog: v2.0.10-preview...v2.0.0-rc

Don't miss a new medusa release

NewReleases is sending notifications on new releases.