Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add a troubleshooting guide for dist imports #9442

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions www/apps/resources/app/troubleshooting/dist-imports/page.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
export const metadata = {
title: `Importing from /dist Sub-Path`,
}

# {metadata.title}

Because of how Medusa packages are bundled and released, importing from the `/dist` sub-path of its packages is not allowed.

For example, this is not allowed:

```ts
import {
AdminGetApiKeysParams
} from "@medusajs/medusa/dist/api/admin/api-keys" // <-- Not allowed
```

## Importing from Exposed Directories

The `@medusajs/medusa` package allows you to import from the following sub-directories:

- `api`
- `subscribers`
- `jobs`
- `core-flows`
- `loaders`
- `commands`

So, you can still import `AdminGetApiKeysParams` from the example above, however, the import path shouldn't include `/dist`.

So, this is allowed:

```ts
import {
AdminGetApiKeysParams
} from "@medusajs/medusa/api/admin/api-keys" // <-- Allowed
```
11 changes: 0 additions & 11 deletions www/apps/resources/app/troubleshooting/pnpm-errors/page.mdx

This file was deleted.

4 changes: 2 additions & 2 deletions www/apps/resources/generated/edit-dates.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ export const generatedEditDates = {
"app/troubleshooting/errors-after-upgrading/page.mdx": "2024-07-11T10:29:13+03:00",
"app/troubleshooting/errors-installing-cli/page.mdx": "2024-05-03T17:36:38+03:00",
"app/troubleshooting/general-errors/page.mdx": "2024-05-03T17:36:38+03:00",
"app/troubleshooting/pnpm-errors/page.mdx": "2024-08-13T09:54:56+03:00",
"app/troubleshooting/s3/page.mdx": "2024-08-06T09:59:46+03:00",
"app/troubleshooting/page.mdx": "2024-07-18T08:57:11+02:00",
"app/upgrade-guides/page.mdx": "2024-07-18T08:57:11+02:00",
Expand Down Expand Up @@ -2223,5 +2222,6 @@ export const generatedEditDates = {
"references/types/types/types.AdminBaseReturnReasonPayload/page.mdx": "2024-10-03T00:11:53.303Z",
"references/user/IMessageAggregator/methods/user.IMessageAggregator.getMessages/page.mdx": "2024-10-03T00:12:20.668Z",
"references/user/interfaces/user.IModuleService/page.mdx": "2024-10-03T00:12:20.657Z",
"references/user/interfaces/user.MessageAggregatorFormat/page.mdx": "2024-10-03T00:12:20.662Z"
"references/user/interfaces/user.MessageAggregatorFormat/page.mdx": "2024-10-03T00:12:20.662Z",
"app/troubleshooting/dist-imports/page.mdx": "2024-10-03T09:19:37.639Z"
}
8 changes: 4 additions & 4 deletions www/apps/resources/generated/files-map.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,10 @@ export const filesMap = [
"filePath": "/www/apps/resources/app/troubleshooting/deployment/page.mdx",
"pathname": "/troubleshooting/deployment"
},
{
"filePath": "/www/apps/resources/app/troubleshooting/dist-imports/page.mdx",
"pathname": "/troubleshooting/dist-imports"
},
{
"filePath": "/www/apps/resources/app/troubleshooting/eaddrinuse/page.mdx",
"pathname": "/troubleshooting/eaddrinuse"
Expand All @@ -935,10 +939,6 @@ export const filesMap = [
"filePath": "/www/apps/resources/app/troubleshooting/page.mdx",
"pathname": "/troubleshooting"
},
{
"filePath": "/www/apps/resources/app/troubleshooting/pnpm-errors/page.mdx",
"pathname": "/troubleshooting/pnpm-errors"
},
{
"filePath": "/www/apps/resources/app/troubleshooting/s3/page.mdx",
"pathname": "/troubleshooting/s3"
Expand Down
16 changes: 8 additions & 8 deletions www/apps/resources/generated/sidebar.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8631,14 +8631,6 @@ export const generatedSidebar = [
"title": "Errors Installing CLI",
"children": []
},
{
"loaded": true,
"isPathHref": true,
"type": "link",
"path": "/troubleshooting/pnpm-errors",
"title": "pnpm Errors",
"children": []
},
{
"loaded": true,
"isPathHref": true,
Expand Down Expand Up @@ -8670,6 +8662,14 @@ export const generatedSidebar = [
"path": "/troubleshooting/database-errors",
"title": "Database Errors",
"children": []
},
{
"loaded": true,
"isPathHref": true,
"type": "link",
"path": "/troubleshooting/dist-imports",
"title": "Importing from /dist",
"children": []
}
]
},
Expand Down
10 changes: 5 additions & 5 deletions www/apps/resources/sidebar.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2123,11 +2123,6 @@ export const sidebar = sidebarAttachHrefCommonOptions([
path: "/troubleshooting/errors-installing-cli",
title: "Errors Installing CLI",
},
{
type: "link",
path: "/troubleshooting/pnpm-errors",
title: "pnpm Errors",
},
{
type: "link",
path: "/troubleshooting/general-errors",
Expand All @@ -2149,6 +2144,11 @@ export const sidebar = sidebarAttachHrefCommonOptions([
path: "/troubleshooting/database-errors",
title: "Database Errors",
},
{
type: "link",
path: "/troubleshooting/dist-imports",
title: "Importing from /dist"
}
],
},
{
Expand Down
Loading