Cron.js does not work in V4

following the document

i do this

// path: ./config/server.js

const cronTasks = require("./cron-tasks");

but obtain this

config/server.js: Cannot find module ‘./cron-tasks’

any idea ?

( for example npm run strapi install cron-tasks does not work )


PS: i also did try the V3 way but this does not work either (the config/functions/cron.js has no effect)

System Information
  • Strapi Version: 4.0.2
  • Operating System:
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version:

Below setup is working for me in v4. You can give it a try:
Config/server.js setup:-

cron job setup file - config/cronTasks.js


this works great thx alot