Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nitro scanModules returns every files #2680

Open
Barbapapazes opened this issue Aug 22, 2024 · 0 comments · Fixed by #2681
Open

Nitro scanModules returns every files #2680

Barbapapazes opened this issue Aug 22, 2024 · 0 comments · Fixed by #2681

Comments

@Barbapapazes
Copy link
Member

Environment

nitropack-nightly@3.0.0-beta-28665895.e727afda-nitro-nightly-mirror

Reproduction

  1. Create the dir modules
  2. Add the file log/index.ts and log/runtime/routes/log.ts
  3. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant