@mercurjs/dashboard-sdk 2.2.0-canary.2 → 2.2.0-canary.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +13 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -707,11 +707,18 @@ function trimTrailingSlashes(value) {
|
|
|
707
707
|
return end === value.length ? value : value.slice(0, end);
|
|
708
708
|
}
|
|
709
709
|
async function loadMedusaConfig(medusaConfigPath, root, options) {
|
|
710
|
+
const configDir = import_path5.default.dirname(medusaConfigPath);
|
|
710
711
|
try {
|
|
711
|
-
const
|
|
712
|
+
const previousCwd = process.cwd();
|
|
713
|
+
let mod;
|
|
714
|
+
process.chdir(configDir);
|
|
715
|
+
try {
|
|
716
|
+
mod = await getFileExports(medusaConfigPath);
|
|
717
|
+
} finally {
|
|
718
|
+
process.chdir(previousCwd);
|
|
719
|
+
}
|
|
712
720
|
const medusaConfig = mod.default ?? mod;
|
|
713
721
|
const modules = medusaConfig?.modules ?? {};
|
|
714
|
-
const configDir = import_path5.default.dirname(medusaConfigPath);
|
|
715
722
|
let base;
|
|
716
723
|
let appType = "admin";
|
|
717
724
|
let vendorAppUrl;
|
|
@@ -742,7 +749,10 @@ async function loadMedusaConfig(medusaConfigPath, root, options) {
|
|
|
742
749
|
) ?? [];
|
|
743
750
|
const pluginExtensions = resolvePluginExtensions(plugins, configDir, appType);
|
|
744
751
|
return { base, pluginExtensions, vendorAppUrl };
|
|
745
|
-
} catch {
|
|
752
|
+
} catch (error) {
|
|
753
|
+
console.warn(
|
|
754
|
+
`[@mercurjs/dashboard-sdk] Could not load the Medusa config from "${medusaConfigPath}": ${error instanceof Error ? error.message : String(error)}. Building with base "/" and no plugin extensions \u2014 if this panel is served under a sub-path (e.g. /dashboard), its assets will not resolve.`
|
|
755
|
+
);
|
|
746
756
|
return { pluginExtensions: [] };
|
|
747
757
|
}
|
|
748
758
|
}
|