hywax / nuxt-cron

A Nuxt module for cron jobs in your app.
https://nuxt-cron.hywax.space
MIT License
64 stars 3 forks source link

fix: use serverDir instead of srcDir for new Nuxt 4 file structure #66

Closed blqke closed 4 months ago

blqke commented 4 months ago

Nuxt 4 introduces a new default directory structure

With this new structure enabled on a Nuxt 3 project using the following configuration:

future: {
  compatibilityVersion: 4,
}

This module is not working anymore, because the module resolve cron directory to <srcDir> which is app/ by default, and therefore tries to resolve app/server/cron/ by default, and not server/cron/,

Check it here -> https://stackblitz.com/edit/github-hessqh?file=src/module.ts

I believe it should try to resolve <serverDir>, which by default is <rootDir>/server when compatibilityVersion: is set to 4, andย <srcDir>/server otherwise.

I believe there is no breaking change for those who havent migrated to the new structure.

hywax-assistant commented 4 months ago

๐Ÿ‘‹ @blqke

๐Ÿ’– Thanks for opening this pull request!

Please follow the contributing guidelines. And we use semantic commit messages to streamline the release process.

Examples of commit messages with semantic prefixes:

hywax commented 4 months ago

Hi, I saw that nuxt changed the structure. Thank you for your PR. I will do a merge of your commit shortly

hywax-assistant commented 4 months ago

๐Ÿ‘‹ @blqke Congrats on merging your first pull request! ๐ŸŽ‰