question
Pulled down a vue3+vite
project from GitHub today, before it can run after installing dependencies, but it keeps reporting an error today, showingTypeError: vite.createFilter is not a function
wrong reason
The vite version does not match the installed dependency version
Vite3 was released recently, but we still use v2, so the latest version is installed by default when installing the dependency, which will cause a mismatch between the version and the installed dependency
Another point to note is that Vite no longer supports Node 12 / 13 / 15, because Vite has entered the EOL stage. Node 14.18+ / 16+ versions must now be used
Solution
① Upgrade to vite3
npm install -D vite@^3.0.0
pnpm add -D vite@^3.0.0
②Reduce the plug-in version
npm i @vitejs/[email protected]
Reference: https://blog.csdn.net/weixin_50763257/article/details/126061965
https://laracasts.com/discuss/channels/vite/vitecreatefilter-is-not-a-function