v2.0.0-rc
Pre-releaseWhat's Changed
All the core-level utilities are exposed 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
.
New Contributors
- @dependabot made their first contribution in #1
- @Mohmdev made their first contribution in #2
Full Changelog: v2.0.10...v2.0.0-rc