Skip to content

Commit 766ce37

Browse files
committed
fix(@nestjs/apollo): lazy-load the express dependency to allow the Fastify setup
1 parent f700174 commit 766ce37

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/apollo/lib/drivers/apollo-base.driver.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
ApolloServerErrorCode,
55
unwrapResolverError,
66
} from '@apollo/server/errors';
7-
import { expressMiddleware } from '@as-integrations/express5';
87
import { ApolloServerPluginLandingPageDisabled } from '@apollo/server/plugin/disabled';
98
import { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer';
109
import { HttpStatus } from '@nestjs/common';
@@ -126,6 +125,12 @@ export abstract class ApolloBaseDriver<
126125
options: T,
127126
{ preStartHook }: { preStartHook?: () => void } = {},
128127
) {
128+
const { expressMiddleware } = loadPackage(
129+
'@as-integrations/express5',
130+
'GraphQLModule',
131+
() => require('@as-integrations/express5'),
132+
);
133+
129134
const { path, typeDefs, resolvers, schema } = options;
130135

131136
const httpAdapter = this.httpAdapterHost.httpAdapter;

0 commit comments

Comments
 (0)