ApolloServer constructor modules combination with schemaDirectives, schemaDirectives does not work

here is my code:

class hasServiceDirective extends SchemaDirectiveVisitor {

  visitFieldDefinition(field) {

      const { resolve = defaultFieldResolver } = field;

      // reading directive args

      console.log(this.visitedType.name);

      const { service } = this.args;

      console.log("Inside FieldDefinition function");

      field.resolve = async (...args) => {

        const context = args[2];

        const services = context.services;

          if(services.includes(service)) {

            return await resolve.apply(this, args);

          } else  {

            return "";

          }

      }

  }

}
const server = new ApolloServer({

   modules: [blogModule],

   schemaDirectives: {

    hasService: hasServiceDirective,

  },

  plugins: [ loggingPlugin ],

  context: ({event}) => {

    const headers = event.headers;

    const userId = headers.userid || null;

    const services = headers.services || null;

    return { 

      userId,

      services,

      prisma

     };

  },

   playground: {

    //endpoint: "/dev/graphql"

    settings: {

      'schema.polling.enable': false,

      'schema.polling.interval': 5000,

    }

   }

});
const books = [

  {

    title: 'The Awakening',

    author: 'Kate Chopin',

  },

  {

    title: 'City of Glass',

    author: 'Paul Auster',

  },

];

const users = [

  {

    name: 'Manish',

    password: 'manish@123',

  },

  {

    name: 'Monu',

    password: 'monu@123',

  },

];

If i user typeDefs, resolver property in apolloServer, my custom Directive is working but when i use modules, it isn’t working. I will have many typeDefs and resolvers in future so I m using modules property of ApolloServer constructor to call schemas.

What version of Apollo Server are you using?