Cannot convert undefined or null to object when build "vite": "^4.0.4",
when I build the project with vue 2.7.14 vite v4, i have an error if i run dev I don't have this problem
To Reproduce
- yarn build
- yarn preview


package.json

vite.config.ts
import {defineConfig, loadEnv} from 'vite'
import eslintPlugin from 'vite-plugin-eslint'
import {VuetifyResolver} from 'unplugin-vue-components/resolvers'
import {fileURLToPath, URL} from 'node:url'
import vue from '@vitejs/plugin-vue2'
import components from 'unplugin-vue-components/vite'
export default defineConfig(({mode}) => {
process.env = {...process.env, ...loadEnv(mode, process.cwd(), '')}
return {
plugins: [
vue(),
eslintPlugin(),
components({
resolvers: [VuetifyResolver()],
}),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
extensions: ['.js', '.json', '.jsx', '.mjs', '.ts', '.tsx', '.vue'],
},
css: {
preprocessorOptions: {
sass: {
additionalData: ['@import "./src/scss/variables"', ''].join('\n'),
},
},
},
define: {
'process.env': process.env,
},
server: {
port: 3000,
host: true,
},
}
})
it doesn't work
import {required} from 'vuelidate/lib/validators'
but it work's well
import required from 'vuelidate/lib/validators/required'
why does it happen?
@stillgg, It looks like you are using an outdated Vuelidate version.
Correct path:
import { required } from "@vuelidate/validators";
@stillgg, It looks like you are using an outdated Vuelidate version.
Correct path:
import { required } from "@vuelidate/validators";
my version of vuelidate : "vuelidate": "^0.7.7" it's the last version for vue 2
Both versions (Vue 2/ Vue 3) are supported according to the documentation.
I don't find this information can you share this link of docs
https://github.com/vuelidate/vuelidate/blob/next/README.md#vuelidate
thanks a lot