@felloz Why do you want to import it in your app.js file? I suggest you to import it in the specific components that need the package.
Jan 8, 2023
5
Level 1
Import moment in app.js with Inertia and Vue 3
Hello,
I would like to import the library moment in my app.js file, this is my code but is not working...
import moment from 'moment'
createInertiaApp({
title: (title) => `${title} - ${appName}`,
resolve: (name) =>
resolvePageComponent(
`./Pages/${name}.vue`,
import.meta.glob('./Pages/**/*.vue')
),
setup({ el, app, props, plugin }) {
return createApp({ render: () => h(app, props) })
.use(moment) // Here im using it
.component('InertiaLink', Link)
.component('Datepicker', Datepicker)
.use(ZiggyVue, Ziggy)
.mount(el);
},
});
Im getting this error:
Uncaught (in promise) TypeError: _ctx.moment is not a function
Please or to participate in this conversation.