Open kotx opened 2 years ago
Thanks, we'll look into this.
In the meantime you can change the target to "es6"
without issue. Next.js only uses "es5"
a very conservative default to support legacy browsers.
Also, seems like node-fetch@2 is required with Next.js here? https://github.com/edgedb/edgedb-js/blob/438c9b2ebb06a8165ef2dfc4bb0130aa3868cef4/packages/driver/src/httpScram.ts#L40 Not entirely sure how the Next.js polyfill works, but the library does not seem to pick it up.
Edit: Additionally, it looks like Next.js is ignoring some typescript compiler options? (https://github.com/vercel/next.js/issues/37271)
info - Linting and checking validity of types ...Failed to compile.
./dbschema/edgeql-js/funcops.ts:331:8
Type error: Type 'Set<any>' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher.
329 | }
330 | const descendants: string[] = [
> 331 | ...new Set(
| ^
332 | [...typeSpec.values()]
333 | .filter(
334 | type =>
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Neither downlevelIteration or target modifications in tsconfig resolve the error on Next.js 13.
Got the same issue here. I had to npm i -D node-fetch@2 encoding
to make it work.
Related: #566
Looks like the issue with the target: es5
bit is something the Next.js team is working on, I've seen similar issues myself. I'll leave this open and keep an eye out for a fix landing there.
Describe the bug When using the generated client library from
npx edgeql-js
, runningnext build
results in this error:Reproduction
I made a repository with the same error here: https://github.com/kotx/edgedb-nextjs-repro
Expected behavior No build error occurs
**Versions
edgedb-js
version: 0.21.1Additional context I tried to add
dbschema/edgeql-js
to theexclude
array intsconfig.json
but it didn't affect the result.