function mergeWithModules({ logger, moduleName, modulePackageName, packageName, old }) {
  // Get modules entry point file path
  const modulesEntry = getModulesEntryPoint(packageName, old);
  let indexContent;

  try {
    // Retrieve the content of the modules.ts
    indexContent = `import ${moduleName} from '${computeModulePackageName(
      moduleName,
      modulePackageName,
      old
    )}';\n${fs.readFileSync(modulesEntry)}`;
  } catch (e) {
    logger.error(chalk.red(`Failed to read ${modulesEntry} file`));
    process.exit();
  }

  // Extract application modules from the modules.ts
  const appModuleRegExp = /Module\(([^()]+)\)/g;
  const [, appModules] = appModuleRegExp.exec(indexContent) || ['', ''];

  // Add a module to app module list
  shell
    .ShellString(indexContent.replace(RegExp(appModuleRegExp, 'g'), `Module(${moduleName}, ${appModules})`))
    .to(modulesEntry);
  runPrettier(modulesEntry);
}
Imports module to modules entry file.