Closed lmiller1990 closed 8 months ago
Getting the same issue. @lmiller1990 have u found any workaround ?
There is no work around, a patch will need to be submitted to directly expose the exports. The module uses Nuxt things like #imports
, though, so the code would need to be updated to not use any of those if this library is to work in projects with autoImports: false
.
@BracketJohn @zoey-kaiser is this a PR that would be accepted? Basically:
#imports
or any Nuxt specific module resolution in the source codepackage.json > exports
.@lmiller1990, may I ask in which use-case you disable the autoimports? This is primarily, so I can estimate the priority of restructuring the exports/imports!
I onboard a lot of developers coming from React/Next, and having explicit imports makes it much easier. With all the auto injection magic Nuxt encourages, it's incredibly difficult to know where things are coming from, especially for developers new to Nuxt.
The IDE doesn't work as well (I can't just use "Go to definition" on globals, it doesn't know where to look). I also find it hard to remember how/where/what is automatically injected.
These are my main pain points with global injection. Most of the other modules I'm using can be imported manually, but not Sidebase/Nuxt Auth.
Hi @lmiller1990,
I totally understand this. I will put this on the roadmap, however I don't think, I will include this for the 0.6.0 release just yet, as exposing these functions may change how the automatic imports work. I think including this in the 0.7.0 release is definitely possible!
As to your code editor: We have a few nice setup guides here: https://sidebase.io/sidebase/resources/coding-setup that show you how you can configure VSCode to work nicely with all the automatic imports from Nuxt 3, as I know the pain myself. Some code editors like Webstorm, sadly have pretty bad support for Nuxt 3, so I would not recommend using them for now! I hope this may be able to help you!
Thanks for the link. I tried following that - I'm not using TS, just JS - still no luck, even with VS Code.
Anyway, that's an unrelated problem to the issue, I'll look into this on my own. Thanks!
Environment
Reproduction
I just tried a basic Nuxt project and added the latest version of Sidebase, the 0.6 beta.
Describe the bug
I am getting
When I try to import
I have tried with
type: module
and using.mjs
, too. I have turned off auto imports in my Nuxt config.Additional context
I think the issue is we don't expose the exports in
package.json
. I tried fixing it:But now I get
Since, of course, the module resolution does not know about
#imports
.Any interest in making this work without the Nuxt magic imports?
Logs
No response