Graphql: Writing definitions creates infinite restarting loop

Created on 12 Nov 2018  路  4Comments  路  Source: nestjs/graphql

I'm submitting a...


[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

Providing a definitions option that writes a TypeScript class:

      definitions: {
        path: path.resolve(__dirname, 'app.graphql.ts'),
        outputAs: 'class',
      },

This works as expected, but when running in dev mode, will keep restarting, because on every start the file is written and the change is detected by Nodemon.

Expected behavior

No restart is necessary.

Minimal reproduction of the problem with instructions

Add the following config option:

      definitions: {
        path: path.resolve(__dirname, 'app.graphql.ts'),
        outputAs: 'class',
      },

Then start in dev mode:

npm run start:dev

What is the motivation / use case for changing the behavior?

To prevent endless restarts.

Environment


[System Information]
OS Version     : macOS
NodeJS Version : v10.5.0
NPM Version    : 6.4.1
[Nest Information]
graphql version : 5.4.0
common version  : 5.4.0
core version    : 5.4.0
bug done

Most helpful comment

This, of course, can be fixed by adding the file to Nodemon ignore:

  "ignore": ["src/**/*.spec.ts", "src/app.graphql.ts"],

Maybe needs to be documented?

All 4 comments

This, of course, can be fixed by adding the file to Nodemon ignore:

  "ignore": ["src/**/*.spec.ts", "src/app.graphql.ts"],

Maybe needs to be documented?

Should be fixed in 5.5.0 due to #81

For the people who are using angular + nrwl nx and running ng serve, be sure to omit any comments on the schema file, as the lib will compare if there are changes and the comments were not removed.

eg. from the example (graphql.schema.ts)
/* tslint:disable */ <--- remove this

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

liudonghua123 picture liudonghua123  路  3Comments

devniel picture devniel  路  4Comments

willsoto picture willsoto  路  5Comments

ghost picture ghost  路  5Comments

danil-z picture danil-z  路  4Comments