autoImport for utils directory doesn't work correctly.
AtosLab opened this issue · comments
Environment
- Operating System: Windows_NT
- Node Version: v18.17.1
- Nuxt Version: 3.10.2
- CLI Version: 3.10.1
- Nitro Version: 2.8.1
- Package Manager: yarn@1.22.21
- Builder: -
- User Config: ssr, runtimeConfig, build, devtools, routeRules, modules, vite,
css, sourcemap - Runtime Modules: (), @pinia/nuxt@0.5.1
- Build Modules: -
Reproduction
.
Describe the bug
custom components inside components directory are imported automatically but not fuctions in utils directory.
Additional context
No response
Logs
ReferenceError: XXX is not defined
Could you come up with a reproduction?
Would you be able to provide a reproduction? 🙏
More info
Why do I need to provide a reproduction?
Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making.
What will happen?
If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritize it based on its severity and how many people we think it might affect.
If needs reproduction
labeled issues don't receive any substantial activity (e.g., new comments featuring a reproduction link), we'll close them. That's not because we don't care! At any point, feel free to comment with a reproduction and we'll reopen it.
How can I create a reproduction?
We have a couple of templates for starting with a minimal reproduction:
👉 https://stackblitz.com/github/nuxt/starter/tree/v3-stackblitz
👉 https://codesandbox.io/s/github/nuxt/starter/v3-codesandbox
A public GitHub repository is also perfect. 👌
Please ensure that the reproduction is as minimal as possible. See more details in our guide.
You might also find these other articles interesting and/or helpful:
I've tested the sample project what nuxt provides.
here's the link
https://github.com/nuxt/examples/tree/main/examples/features/auto-imports
it doesn't worked on my local env.
the frontend is displaying on browser but it returns the error like this.
I've just checked the auto-imports example project locally and it works fine. Make sure you haven't made any changes which might have an impact on this. A valid reproduction is still needed to be able to help you.
Note the title of your issue mentions the utils/
folder, whether your comment above describes sayHello
function from the composables/
folder.
I encountered a similar issue previously, and it was related to my project directory's permissions. Perhaps you could try moving your project to another folder, ensuring that the directory is writable, and then run your project again.
Make sure that your .nuxt folder is writable, as it is generated when you run dev
or nuxi prepare
.