antfu-collective / vite-ssg

Static site generation for Vue 3 on Vite
MIT License
1.31k stars 135 forks source link

Unable to compile with Vee Validate v4 #291

Closed dvlden closed 1 year ago

dvlden commented 1 year ago

Describe the bug

Using VeeValidate's useForm() – throws a reference error while rendering pages.

ReferenceError: File is not defined 
at isEqual (/Users/nn/Sites/micro-sh/node_modules/.pnpm/vee-validate@4.6.9_vue@3.2.39/node_modules/vee-validate/dist/vee-validate.js:169:28)

I tested with npm and pnpm – it's the same error. Narrowed it down from all the Vite dependencies to Vite SSG and it's a problem with it alone, as seen in the repro.

Run npm run export and you'll see the reference error in the console.

Reproduction

https://stackblitz.com/edit/vitejs-vite-dkdkrm

System Info

My details:

System:
    OS: macOS 12.5.1
    CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
    Memory: 211.79 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
Binaries:
    Node: 18.8.0 - /usr/local/bin/node
    npm: 8.19.2 - /usr/local/bin/npm
Browsers:
    Chrome: 105.0.5195.125
    Firefox Developer Edition: 106.0
    Safari: 15.6.1

–––

On the StackBlitz:
System:
    OS: Linux 5.0 undefined
    CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.17.0 - /usr/local/bin/npm

Used Package Manager

pnpm

Validations

userquin commented 1 year ago

@dvlden it seems adding "web-file-polyfill": "^1.0.4" as dev dependency will fix it: here a forked version https://stackblitz.com/edit/vitejs-vite-pfcvdh?file=package.json

imagen

dvlden commented 1 year ago

Nice find. I have installed it in my project, and the issue is also gone.