Skip to content

Commit

Permalink
fix(js-sdk,admin-bundler): Fix qs import (#11172)
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperkristensen authored Jan 27, 2025
1 parent ea40287 commit 65d8d6d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/nasty-parrots-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@medusajs/admin-bundler": patch
"@medusajs/js-sdk": patch
---

fix(js-sdk,admin-bundler): Import resolve from qs in a way that works in both ESM and CJS projects, and add @medusajs/js-sdk to optimized deps
1 change: 1 addition & 0 deletions packages/admin/admin-bundler/src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export async function getViteConfig(
"react-router-dom",
"@medusajs/ui",
"@medusajs/dashboard",
"@medusajs/js-sdk",
"@tanstack/react-query",
],
exclude: [...VIRTUAL_MODULES],
Expand Down
4 changes: 2 additions & 2 deletions packages/core/js-sdk/src/client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { events } from "fetch-event-stream"
import qs from "qs"
import { stringify } from "qs"
import {
ClientFetch,
Config,
Expand Down Expand Up @@ -242,7 +242,7 @@ export class Client {
const params = Object.fromEntries(
normalizedInput.searchParams.entries()
)
const stringifiedQuery = qs.stringify({ ...params, ...init.query })
const stringifiedQuery = stringify({ ...params, ...init.query })
normalizedInput.search = stringifiedQuery
}
}
Expand Down

0 comments on commit 65d8d6d

Please sign in to comment.