|
1
|
export const metadata = { |
|
2
|
title: `Admin Widget / UI Route Not Showing`, |
|
3
|
} |
|
4
|
|
|
5
|
# {metadata.title} |
|
6
|
|
|
7
|
This troubleshooting guide covers common reasons why an admin widget or UI route may not be showing in your Medusa Admin and how to resolve them. |
|
8
|
|
|
9
|
## Incorrect Zone |
|
10
|
|
|
11
|
If you're adding an admin widget, make sure you're using a correct zone. |
|
12
|
|
|
13
|
Refer to the [Admin Widget Injection Zones list](../../../admin-widget-injection-zones/page.mdx) for reference. |
|
14
|
|
|
15
|
--- |
|
16
|
|
|
17
|
## Incorrect Function Definition |
|
18
|
|
|
19
|
Widget and UI routes must be defined as arrow functions. Any other type of declaration isn't accepted. |
|
20
|
|
|
21
|
Refer to the [Admin Development Constraints](!docs!/learn/fundamentals/admin/constraints) documentation for more details. |
|
22
|
|
|
23
|
--- |
|
24
|
|
|
25
|
## Incorrect Type of Zone Value |
|
26
|
|
|
27
|
A widget zone's value must be wrapped in double or single quotes: |
|
28
|
|
|
29
|
```ts |
|
30
|
export const config = defineWidgetConfig({ |
|
31
|
zone: "product.details", |
|
32
|
}) |
|
33
|
``` |
|
34
|
|
|
35
|
Any other usage leads to the widget not being shown. |
|
36
|
|
|
37
|
Refer to the [Admin Development Constraints](!docs!/learn/fundamentals/admin/constraints) documentation for more details. |
|
38
|
|
|
39
|
--- |
|
40
|
|
|
41
|
## Errors in Docker |
|
42
|
|
|
43
|
If you're using a Docker image to host your Medusa application, make sure that the image's root path is different than the Medusa Admin's `path` configuration. |
|
44
|
|
|
45
|
For example, if your Docker image's root path is `/app`, make sure to change the `path` configuration in `medusa-config.ts`, as it's `/app` by default: |
|
46
|
|
|
47
|
```ts title="medusa-config.ts" |
|
48
|
module.exports = defineConfig({ |
|
49
|
admin: { |
|
50
|
path: `/dashboard`, |
|
51
|
}, |
|
52
|
// ... |
|
53
|
}) |
|
54
|
``` |
|
55
|
|
|
56
|
--- |
|
57
|
|
|
58
|
## Uncaught SyntaxError: The request module does not provide an export named default |
|
59
|
|
|
60
|
If you're using a third-party library that isn't ESM compatible, you might encounter this error in the console when you access the admin. |
|
61
|
|
|
62
|
To resolve it, add the third-party library to `vite`'s `optimizeDeps` configuration in `medusa-config.ts`. For example: |
|
63
|
|
|
64
|
```ts title="medusa-config.ts" |
|
65
|
module.exports = defineConfig({ |
|
66
|
admin: { |
|
67
|
vite: () => { |
|
68
|
return { |
|
69
|
optimizeDeps: { |
|
70
|
include: ["qs"], |
|
71
|
}, |
|
72
|
} |
|
73
|
}, |
|
74
|
}, |
|
75
|
// ... |
|
76
|
}) |
|
77
|
``` |
|
78
|
|
|
79
|
Where `qs` would be the third-party library you're using. |
|
80
|
|
|
81
|
Learn more about the `optimizeDeps` configuration in the [Vite documentation](https://vite.dev/config/dep-optimization-options). Also, learn more about Medusa's admin configurations in [this documentation](!docs!/learn/configurations/medusa-config). |