diff --git a/waspc/data/Generator/templates/react-app/src/index.tsx b/waspc/data/Generator/templates/react-app/src/index.tsx index 9a7a3241e8..8c981ffd23 100644 --- a/waspc/data/Generator/templates/react-app/src/index.tsx +++ b/waspc/data/Generator/templates/react-app/src/index.tsx @@ -7,7 +7,7 @@ import router from './router' import { initializeQueryClient, queryClientInitialized, -} from 'wasp/client/operations' +} from 'wasp/client/operations/queryClient' {=# setupFn.isDefined =} {=& setupFn.importStatement =} diff --git a/waspc/data/Generator/templates/react-app/vite.config.ts b/waspc/data/Generator/templates/react-app/vite.config.ts index ab4224729f..f749e0a1d1 100644 --- a/waspc/data/Generator/templates/react-app/vite.config.ts +++ b/waspc/data/Generator/templates/react-app/vite.config.ts @@ -30,6 +30,7 @@ const defaultViteConfig = { outDir: "build", }, resolve: { + conditions: ["client-runtime"], // These packages rely on a single instance per page. Not dedpuing them // causes runtime errors (e.g., hook rule violation in react, QueryClient // instance error in react-query, Invariant Error in react-router-dom). diff --git a/waspc/data/Generator/templates/sdk/wasp/client/operations/index.ts b/waspc/data/Generator/templates/sdk/wasp/client/operations/index.ts index ec9ca9f689..b929660996 100644 --- a/waspc/data/Generator/templates/sdk/wasp/client/operations/index.ts +++ b/waspc/data/Generator/templates/sdk/wasp/client/operations/index.ts @@ -15,8 +15,4 @@ export { export { // PUBLIC API configureQueryClient, - // PRIVATE API (framework code) - initializeQueryClient, - // PRIVATE API (framework code) - queryClientInitialized } from './queryClient' diff --git a/waspc/data/Generator/templates/sdk/wasp/package.json b/waspc/data/Generator/templates/sdk/wasp/package.json index 77d7682383..acb11cd0ec 100644 --- a/waspc/data/Generator/templates/sdk/wasp/package.json +++ b/waspc/data/Generator/templates/sdk/wasp/package.json @@ -9,6 +9,9 @@ "types": "tsc --declaration --emitDeclarationOnly --stripInternal --declarationDir dist" }, "exports": { + "./client/operations/queryClient": { + "client-runtime": "./dist/client/operations/queryClient.js" + }, {=! todo(filip): Check all exports when done with SDK generation =} {=! Some of the statements in the comments might become incorrect. =} {=! "our code" means: "web-app", "server" or "SDK", or "some combination of the three". =}