How to configure Parse example to pm2 cluster mode?

I’m trying to configure my parse server to cluster mode in pm2 but I get this error:

How can I configure it rigth?

My ecosystem.config.cjs:

module.exports = {
  apps: [
    {
      name: 'xxxx',
      script: 'node --trace-warnings index.js',
      merge_logs  : true,
      ignore_watch: ["logs", "node_modules"],
      watch: false,
      instances: "2",
      exec_mode: "cluster",
    },
  ],
};

My index.js:

import express from 'express';
import { ParseServer } from 'parse-server';
import path from 'path';
const __dirname = path.resolve();
import http from 'http';

var databaseUri = 'xxxx';

export const config = {
  databaseURI: databaseUri,
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: 'xxxx',
  masterKey: 'xxxx',
  masterKeyIps: ['0.0.0.0/0', '::1'],
  serverURL: 'http://localhost:1337/xxx',
  cluster: true,
  allowHeaders: ['X-Parse-Revocable-Session', 'X-Parse-Installation-Id', 'content-type', 'X-Parse-Application-Id', 'X-Parse-Client-Key'],
  verifyUserEmails: false,
  allowClientClassCreation: false,
  verbose: false,
  silent: false,
  appName: 'xxxx',
  emailAdapter: {
      module: 'parse-server-api-mail-adapter',
      options: {
          sender: 'xxxx',
          templates: {
              passwordResetEmail: {
                  subjectPath: './templates/password_reset_email_subject.txt',
                  textPath: './templates/password_reset_email.txt',
                  htmlPath: './templates/password_reset_email.html'
              }
          },
          apiCallback: async ({ payload, locale }) => {
              const mailgunPayload = ApiPayloadConverter.mailgun(payload);
              await mailgunClient.messages.create(mailgunDomain, mailgunPayload);
          }
      }
  },
  fileDownload: {
      enableForPublic: true,
      enableForAnonymousUser: true,
      enableForAuthenticatedUser: true,
  },
  fileUpload: {
      enableForPublic: true,
      enableForAnonymousUser: true,
      enableForAuthenticatedUser: true,
  },
  redisURL: 'redis://localhost:1337/xxxx',
  publicServerURL: 'https://xxx.com/xxxx',
};
// Client-keys like the javascript key or the .NET key are not necessary with parse-server
// If you wish you require them, you can set them as options in the initialization above:
// javascriptKey, restAPIKey, dotNetKey, clientKey

export const app = express();

app.set('trust proxy', true);

// Serve static assets from the /public folder
app.use('/public', express.static(path.join(__dirname, '/public')));

const port = process.env.PORT || 1337;
const httpServer = http.createServer(app);
httpServer.listen(port, function () {
  console.log('parse-server-example running on port ' + port + '.');
});

Solved by changing my index.js:

cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',

to

cloud: function () {
    import(__dirname + '/cloud/main.js');
  },