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

autoImport for utils directory doesn't work correctly. #27257

Closed
AtosLab opened this issue May 16, 2024 · 6 comments
Closed

autoImport for utils directory doesn't work correctly. #27257

AtosLab opened this issue May 16, 2024 · 6 comments

Comments

@AtosLab
Copy link

AtosLab commented May 16, 2024

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
@Jesse1989pp
Copy link

Could you come up with a reproduction?

Copy link
Contributor

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:

@AtosLab
Copy link
Author

AtosLab commented May 17, 2024

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.
image

@DamianGlowala
Copy link
Member

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.

@AtosLab
Copy link
Author

AtosLab commented May 17, 2024

It's also same when I call the utils function directly instead of calling via composables in app.vue.

And, I've tried this project on Ubuntu OS and it worked well.
I'm not sure why it doesn't work on only windows.

image

@kelflame2610
Copy link

kelflame2610 commented May 21, 2024

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.

@danielroe danielroe closed this as not planned Won't fix, can't repro, duplicate, stale May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants