nitro
nitro copied to clipboard
Nitro `scanModules` returns every files
Environment
nitropack-nightly@3.0.0-beta-28665895.e727afda-nitro-nightly-mirror
Reproduction
- Create the dir
modules
- Add the file
log/index.ts
andlog/runtime/routes/log.ts
- Inspect the return of https://github.com/unjs/nitro/blob/d20ffcbd16fc4003b774445e1a01e698c2bb078a/src/core/scan.ts#L44
Describe the bug
You'll see that the return will have both the index.ts
file which define the module and the log.ts
file which define an event handler. This makes the local modules system unusable.
Like Nuxt, this could be nice to only scan two patters (https://nuxt.com/docs/guide/directory-structure/modules#:~:text=The%20auto%2Dregistered,modules/*.ts)
The auto-registered files patterns are:
- modules/*/index.ts
- modules/*.ts
Additional context
No response
Logs
No response