unjs / unimport

Unified utils for auto importing APIs in modules.
MIT License
482 stars 50 forks source link

mongoose and jasonwebtocket autoimport #280

Open theguriev opened 9 months ago

theguriev commented 9 months ago

Describe the feature

How do you guys do something like this? Why it works in case of zod but not in case of mongoose and jasonwebtocket?

{
imports: [
        {
          from: "jsonwebtoken",
          name: "default",
          as: "jwt",
        },
      ],
      presets: [
        {
          from: "zod",
          imports: ["z"],
        },
        {
          from: "mongoose",
          imports: ["model"],
        }
      ],
}
image image image

Additional information

theguriev commented 9 months ago

and one more question if you don't mind...

How to import types?

Like:

{
          from: "h3",
          imports: ["H3Event", "EventHandlerRequest"],
        },
gkTim commented 6 months ago

@theguriev Have found this example:

// example type import { from: 'vue-router', imports: ['RouteLocationRaw'], type: true, },

So could you try to add an type: true