Skip to content

TypeError: loader.loaderId is not a function #1807

@ekil1100

Description

@ekil1100

Describe the bug
Running graphql codegen, get the error:

// use yarn
TypeError: loader.loaderId is not a function
    at /Users/like/repo/mine/blog2.0/node_modules/graphql-config/index.cjs.js:430:79
    at Array.some (<anonymous>)
    at LoadersRegistry.register (/Users/like/repo/mine/blog2.0/node_modules/graphql-config/index.cjs.js:430:28)
    at CodegenExtension (/Users/like/repo/mine/blog2.0/node_modules/@graphql-codegen/cli/index.cjs.js:333:24)
    at GraphQLExtensionsRegistry.register (/Users/like/repo/mine/blog2.0/node_modules/graphql-config/index.cjs.js:523:25)
    at /Users/like/repo/mine/blog2.0/node_modules/graphql-config/index.cjs.js:637:30
    at Array.forEach (<anonymous>)
    at new GraphQLConfig (/Users/like/repo/mine/blog2.0/node_modules/graphql-config/index.cjs.js:636:20)
    at Object.<anonymous> (/Users/like/repo/mine/blog2.0/node_modules/graphql-config/index.cjs.js:591:43)
    at step (/Users/like/repo/mine/blog2.0/node_modules/tslib/tslib.js:143:27)
error Command failed with exit code 1

// use pnpm
❯ pnpm graphql codegen
TypeError: loader.loaderId is not a function
    at /Users/like/repo/mine/blog2.0/node_modules/.pnpm/graphql-config@3.0.3_e33ab83e163f084e27af018354a4217a/node_modules/graphql-config/index.cjs.js:430:79
    at Array.some (<anonymous>)
    at LoadersRegistry.register (/Users/like/repo/mine/blog2.0/node_modules/.pnpm/graphql-config@3.0.3_e33ab83e163f084e27af018354a4217a/node_modules/graphql-config/index.cjs.js:430:28)
    at CodegenExtension (/Users/like/repo/mine/blog2.0/node_modules/.pnpm/@graphql-codegen+cli@2.0.1_a3890eca04e33d0e046f994245c782cb/node_modules/@graphql-codegen/cli/index.cjs.js:333:24)
    at GraphQLExtensionsRegistry.register (/Users/like/repo/mine/blog2.0/node_modules/.pnpm/graphql-config@3.0.3_e33ab83e163f084e27af018354a4217a/node_modules/graphql-config/index.cjs.js:523:25)
    at /Users/like/repo/mine/blog2.0/node_modules/.pnpm/graphql-config@3.0.3_e33ab83e163f084e27af018354a4217a/node_modules/graphql-config/index.cjs.js:637:30
    at Array.forEach (<anonymous>)
    at new GraphQLConfig (/Users/like/repo/mine/blog2.0/node_modules/.pnpm/graphql-config@3.0.3_e33ab83e163f084e27af018354a4217a/node_modules/graphql-config/index.cjs.js:636:20)
    at Object.<anonymous> (/Users/like/repo/mine/blog2.0/node_modules/.pnpm/graphql-config@3.0.3_e33ab83e163f084e27af018354a4217a/node_modules/graphql-config/index.cjs.js:591:43)
    at step (/Users/like/repo/mine/blog2.0/node_modules/.pnpm/tslib@2.3.1/node_modules/tslib/tslib.js:143:27)

Versions (please complete the following information):

  • OS: macOS Big Sur 11.5.1
dependencies:
@emotion/react 11.4.1
@emotion/styled 11.3.0
@graphql-codegen/typescript 2.0.0
@graphql-codegen/typescript-graphql-request 4.0.0
@graphql-codegen/typescript-operations 2.0.1
graphql 15.5.1
graphql-request 3.5.0
next 11.1.0
react 17.0.2
react-dom 17.0.2

devDependencies:
@emotion/babel-plugin 11.3.0        @types/node 16.6.1                  lint-staged 11.1.2
@graphql-cli/codegen 2.0.1          @types/react 17.0.18                npm-run-all 4.1.5
@graphql-cli/coverage 2.1.0         eslint 7.32.0                       prettier 2.3.2
@graphql-cli/diff 2.1.0             eslint-config-like 2.1.1            stylelint 13.13.1
@graphql-cli/similar 2.1.0          eslint-config-next 11.1.0           stylelint-config-prettier 8.0.2
@graphql-cli/validate 2.1.0         graphql-cli 4.1.0                   stylelint-config-recommended 5.0.0
@graphql-codegen/cli 2.0.1          husky 7.0.1                         typescript 4.3.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions