Dragofafmir
Dragofafmir
NNuxt
Created by Dragofafmir on 4/23/2025 in #❓・help
Dayjs building error on run build ?
Hi everyone, I'm running into a build error in my Nuxt 3 app when executing pnpm run build, and I'm wondering if anyone else has experienced this. It seems that Vite (via Rollup) fails to resolve the dayjs/plugin/updateLocale module, even though the plugin is supposed to be included automatically by dayjs-nuxt. Everything works fine during development, but the build fails in CI with this error coming from .nuxt/dayjs.imports.mjs. This feels like a misconfiguration or maybe something that needs to be externalized explicitly — but according to the docs, updateLocale should be handled for us. Has anyone encountered the same issue? Any insight would be appreciated before I dig further or apply a workaround directly in the config. Thanks!
[nuxi] ERROR Nuxt Build Error: [vite]: Rollup failed to resolve import "dayjs/plugin/updateLocale" from "/src/node_modules/.cache/nuxt/.nuxt/dayjs.imports.mjs".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
build.rollupOptions.external
[nuxi] ERROR Nuxt Build Error: [vite]: Rollup failed to resolve import "dayjs/plugin/updateLocale" from "/src/node_modules/.cache/nuxt/.nuxt/dayjs.imports.mjs".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
build.rollupOptions.external
6 replies
NNuxt
Created by Dragofafmir on 4/25/2024 in #❓・help
V-Calendar's DatePicker in FormGroup (Nuxt UI) with Yup validation
Hi ! I tried for a while yesterday to use the DatePicker component of V-Calendar, highlighted in the Nuxt UI doc (https://ui.nuxt.com/components/date-picker). The need I have is simple: two date selectors (of type dateTime) to specify a start date and another end date, in a UForm. So far, you might say, nothing crazy. Then, I wanted to add validation with yup, also highlighted in the Nuxt UI doc. Here's the small portions of my code :
const schema = object({
started_at: date().required('Required'),
ended_at: date().required('Required')
.min(yupRef('started_at'), 'End date should be after start date'),
})
type Schema = InferType<typeof schema>

const state = reactive({
started_at: dayjs().format('YYYY-MM-DDThh:mm'),
ended_at: dayjs().format('YYYY-MM-DDThh:mm'),
})
const schema = object({
started_at: date().required('Required'),
ended_at: date().required('Required')
.min(yupRef('started_at'), 'End date should be after start date'),
})
type Schema = InferType<typeof schema>

const state = reactive({
started_at: dayjs().format('YYYY-MM-DDThh:mm'),
ended_at: dayjs().format('YYYY-MM-DDThh:mm'),
})
<UFormGroup
name="started_at"
label="Start on"
class="grid grid-cols-2 gap-2 items-center"
:ui="{ container: '' }"
>
<DatePicker mode="dateTime" is24hr is-required v-model="state.started_at" />
</UFormGroup>
<UFormGroup
name="ended_at"
label="End on"
class="grid grid-cols-2 gap-2 items-center"
:ui="{ container: '' }"
>
<DatePicker mode="dateTime" is24hr is-required v-model="state.ended_at" />
</UFormGroup>
<UFormGroup
name="started_at"
label="Start on"
class="grid grid-cols-2 gap-2 items-center"
:ui="{ container: '' }"
>
<DatePicker mode="dateTime" is24hr is-required v-model="state.started_at" />
</UFormGroup>
<UFormGroup
name="ended_at"
label="End on"
class="grid grid-cols-2 gap-2 items-center"
:ui="{ container: '' }"
>
<DatePicker mode="dateTime" is24hr is-required v-model="state.ended_at" />
</UFormGroup>
Yup validation works (I tried many ways, did some debugging to see if the validation worked well). It is therefore - a priori - not on that side. With datetime-local type input fields, it works. The DatePicker does not. Can anyone first tell me if I should ask the question on the V-Calendar repo or does anyone have an idea of ​​the problem? Thanks !
1 replies