From 6cd8249a2cd4fba3450f39343b4988f0cdaca1ec Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Mon, 3 Feb 2025 16:30:29 +0200 Subject: [PATCH] docs: add troubleshooting for admin optimizeDeps (#11282) --- .../medusa-admin/no-widget-route/page.mdx | 27 +++++++++++++++++++ www/apps/resources/generated/edit-dates.mjs | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/www/apps/resources/app/troubleshooting/medusa-admin/no-widget-route/page.mdx b/www/apps/resources/app/troubleshooting/medusa-admin/no-widget-route/page.mdx index c4089a1ce8..ce36ad453d 100644 --- a/www/apps/resources/app/troubleshooting/medusa-admin/no-widget-route/page.mdx +++ b/www/apps/resources/app/troubleshooting/medusa-admin/no-widget-route/page.mdx @@ -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). diff --git a/www/apps/resources/generated/edit-dates.mjs b/www/apps/resources/generated/edit-dates.mjs index 3a9864c235..b50883ff4e 100644 --- a/www/apps/resources/generated/edit-dates.mjs +++ b/www/apps/resources/generated/edit-dates.mjs @@ -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",