docs: add troubleshooting for admin optimizeDeps (#11282)

This commit is contained in:
Shahed Nasser
2025-02-03 16:30:29 +02:00
committed by GitHub
parent c366ae3b61
commit 6cd8249a2c
2 changed files with 28 additions and 1 deletions

View File

@@ -52,3 +52,30 @@ module.exports = defineConfig({
// ...
})
```
---
## Uncaught SyntaxError: The request module does not provide an export named default
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.
To resolve it, add the third-party library to `vite`'s `optimizeDeps` configuration in `medusa-config.ts`. For example:
```ts title="medusa-config.ts"
module.exports = defineConfig({
admin: {
vite: () => {
return {
optimizeDeps: {
include: ["qs"],
},
};
},
},
// ...
})
```
Where `qs` would be the third-party library you're using.
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](/references/medusa-config).

View File

@@ -233,7 +233,7 @@ export const generatedEditDates = {
"references/core_flows/core_flows.Order/page.mdx": "2024-12-23T12:30:24.071Z",
"references/modules/core_flows/page.mdx": "2025-01-27T11:43:48.472Z",
"references/types/types.HttpTypes/page.mdx": "2025-01-27T11:43:53.717Z",
"app/troubleshooting/medusa-admin/no-widget-route/page.mdx": "2024-08-23T11:31:26.346Z",
"app/troubleshooting/medusa-admin/no-widget-route/page.mdx": "2025-02-03T12:42:43.932Z",
"references/auth/IAuthModuleService/methods/auth.IAuthModuleService.createProviderIdentities/page.mdx": "2024-12-09T13:21:36.285Z",
"references/auth/IAuthModuleService/methods/auth.IAuthModuleService.deleteProviderIdentities/page.mdx": "2024-12-09T13:21:36.293Z",
"references/auth/IAuthModuleService/methods/auth.IAuthModuleService.listProviderIdentities/page.mdx": "2024-12-09T13:21:36.277Z",