vinejs / vine

VineJS is a form data validation library for Node.js
https://vinejs.dev
MIT License
1.01k stars 22 forks source link

vine.file is not a function #62

Open mohitxskull opened 6 days ago

mohitxskull commented 6 days ago

Package version

2.1.0

Describe the bug

This is the error i am getting when i run node ace. The development server is working fine and there are no problem even when i build the application.

   TypeError: vine.file is not a function

   at anonymous app/validators/index.ts:56
   51|    .transform((value) => new Secret(value))
   52|  
   53|  // ==================== User
   54|  
   55|  export const EmailSchema = vine.string().email({
 ❯ 56|    host_whitelist: ['gmail.com'],
   57|  })
   58|  
   59|  export const PasswordSchema = vine
   60|    .string()
   61|    .minLength(6)

This is my code on line 102

export const ImageFileSchema = vine.file({ size: '5mb', extnames: ['png', 'jpg', 'avif', 'webp'] })

According to docs i can use it like this and in vscode function dropdown the file function is showing

Reproduction repo

No response

RomainLanz commented 6 days ago

Hey @mohitxskull! 👋🏻

Have you configured the package with node ace configure vinejs?

mohitxskull commented 6 days ago

Heyy @RomainLanz

i don't remember doing so because i didn't setup the project today but i checked the steps which are performed when we do that and vinejs was there when i checked provider list

  providers: [
    () => import('@adonisjs/core/providers/app_provider'),
    () => import('@adonisjs/core/providers/hash_provider'),
    {
      file: () => import('@adonisjs/core/providers/repl_provider'),
      environment: ['repl', 'test'],
    },
    () => import('@adonisjs/core/providers/vinejs_provider'),
    () => import('@adonisjs/cors/cors_provider'),
    () => import('@adonisjs/lucid/database_provider'),
    () => import('@adonisjs/auth/auth_provider'),
    () => import('@adonisjs/bouncer/bouncer_provider'),
    () => import('@adonisjs/mail/mail_provider'),
    () => import('@adonisjs/limiter/limiter_provider'),
    () => import('@adonisjs/core/providers/edge_provider'),
  ],

And i saw this in docs just now so it looks like the problem is on my side 😅

mohitxskull commented 4 days ago

Heyy @RomainLanz

Please can i get your help here?

RomainLanz commented 3 days ago

Could you please create a repository with the minimum amount of code to reproduce your issue?

mohitxskull commented 4 hours ago

Heyy i was not able to reproduce the error, i think there is problem with packages i have installed