Error: Option 'bundler' can only be used when 'module' is set to 'es2015' or later.
schmidsi opened this issue Β· comments
If I follow the steps of adding Graph Client to a fresh install of Next.js with TypeScript, running npx graphclient build
yields the following output:
π‘ GraphClient Cleaning existing artifacts
π‘ GraphClient Reading the configuration
π‘ GraphClient Generating the unified schema
π₯ GraphClient - uniswapv2 Failed to generate the schema Error: Failed to fetch introspection from https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2: error TS5095: Option 'bundler' can only be used when 'module' is set to 'es2015' or later.
at GraphQLHandler.getMeshSource (/Users/schmidsi/Development/@schmidsi/module-resolution-test/node_modules/@graphql-mesh/graphql/cjs/index.js:339:23)
at async /Users/schmidsi/Development/@schmidsi/module-resolution-test/node_modules/@graphql-mesh/runtime/cjs/get-mesh.js:128:28
at async Promise.allSettled (index 0)
at async getMesh (/Users/schmidsi/Development/@schmidsi/module-resolution-test/node_modules/@graphql-mesh/runtime/cjs/get-mesh.js:123:5)
at async Object.handler (/Users/schmidsi/Development/@schmidsi/module-resolution-test/node_modules/@graphql-mesh/cli/cjs/index.js:311:53)
π₯ GraphClient Error: Schemas couldn't be generated successfully. Check for the logs by running Mesh with DEBUG=1 environmental variable to get more verbose output.
at getMesh (/Users/schmidsi/Development/@schmidsi/module-resolution-test/node_modules/@graphql-mesh/runtime/cjs/get-mesh.js:162:15)
at async Object.handler (/Users/schmidsi/Development/@schmidsi/module-resolution-test/node_modules/@graphql-mesh/cli/cjs/index.js:311:53)
The error can be fixed with changing "moduleResolution"
from "bundler"
to "node"
. That being said, this might not be obvious for a lot of developers. Is it possible to make Graph Client work with "moduleResolution": "bundler"
?
Steps to reproduce
hint: Content of graphclientrc.yml
npx create-next-app@latest
β What is your project named? β¦ module-resolution-test
β Would you like to use TypeScript? β¦ No / Yes
β Would you like to use ESLint? β¦ No / Yes
β Would you like to use Tailwind CSS? β¦ No / Yes
β Would you like to use `src/` directory? β¦ No / Yes
β Would you like to use App Router? (recommended) β¦ No / Yes
β Would you like to customize the default import alias (@/*)? β¦ No / Yes
cd module-resolution-test
npm install --save-dev @graphprotocol/client-cli
touch .graphclientrc.yml
npx graphclient build