I’m getting a build error when trying to deploy a static nextjs project on Cloudflare Pages. The error seems to be specific to @rtk-query/graphql-request-base-query
and how it imports GraphQLClient
.
The project builds fine locally, and on Vercel.
Here is bare-bones repo that has the problem: GitHub - KolbySisk/static-nextjs
The error:
09:22:37.927 > Build error occurred
09:22:37.929 file:///opt/buildhome/repo/node_modules/@rtk-query/graphql-request-base-query/dist/index.modern.js:1
09:22:37.929 import{GraphQLClient as e,ClientError as r}from"graphql-request";const t=t=>{const s="client"in t?t.client:new e(t.url);return"requestHeaders"in t&&s.setHeaders(t.requestHeaders),async({document:e,variables:t})=>{try{return{data:await s.request(e,t),meta:{}}}catch(e){if(e instanceof r){const{name:r,message:t,stack:s,request:a,response:n}=e;return{error:{name:r,message:t,stack:s},meta:{request:a,response:n}}}throw e}}};export{t as graphqlRequestBaseQuery};
09:22:37.929 ^^^^^^^^^^^^^
09:22:37.929 SyntaxError: The requested module 'graphql-request' does not provide an export named 'GraphQLClient'
09:22:37.929 at ModuleJob._instantiate (internal/modules/esm/module_job.js:92:21)
09:22:37.929 at async ModuleJob.run (internal/modules/esm/module_job.js:107:20)
09:22:37.930 at async Loader.import (internal/modules/esm/loader.js:179:24) {
09:22:37.930 type: 'SyntaxError'
09:22:37.930 }
09:22:37.962 Failed: build command exited with code: 1