I've been trying to get this combination working for a while and fiddled with versions & compatibilities issue until I've hit this brick wall.
The app works in production once you build it -- it appears to solely be a vite issue when running in development mode.
I've created a minium repository where the issue is reproducible: https://github.com/sebastiangug/nest-graphql-vite
The graphql configuration:
const config: ApolloDriverConfig = {
debug: true,
playground: true,
autoSchemaFile: 'schema.gql',
sortSchema: true,
path: "/graphql",
cors: {
origin: ['*'],
},
};
Even if the request is not Graphql related, when the second HTTP request hits the server, vite attempts to do something that causes that schema error.
This seems to be a problem unique to this combination of tools.