We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
- Operating System: Linux - Node Version: v20.18.0 - Nuxt Version: 3.14.1592 - CLI Version: 3.16.0 - Nitro Version: 2.10.4 - Package Manager: [email protected]
/server/utils/sum.ts
export function useSum(a: number, b: number) { return a + b }
/server/api/result:
export default defineEventHandler(() => { const sum = useSum(1, 2) return { sum } })
ERROR useSum is not defined
Everything works fine when pinning [email protected]
[email protected]
No response
The text was updated successfully, but these errors were encountered:
It has been reported Issue
Sorry, something went wrong.
this seems like it might be a regression from #395.
The nitro passes the glob server/utils/*: https://github.com/nitrojs/nitro/blob/575144f0efa9e8115251abb8d0bd09165ecd55f2/src/core/config/resolvers/imports.ts#L30 In versions < 3.14.x, unimport would scan the raw dirs glob and the glob like {dir glob}/*.{ts,js,...}, which worked for nitro. After #395, unimport lost the ability to scan the raw dirs glob, as it only scanned with the glob xxx/server/utils/*/*.{ts,js}, which could not match anything, so the case of nitro was not handled.
nitro
server/utils/*
< 3.14.x
unimport
dirs
{dir glob}/*.{ts,js,...}
xxx/server/utils/*/*.{ts,js}
It will be fixed in issue #400.
Successfully merging a pull request may close this issue.
Environment
Reproduction
/server/utils/sum.ts
/server/api/result:
ERROR useSum is not defined
Describe the bug
Everything works fine when pinning
[email protected]
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: