inertia-statamic icon indicating copy to clipboard operation
inertia-statamic copied to clipboard

How to use with Vue 2?

Open luke-parallax opened this issue 4 years ago • 4 comments

Hey,

I've tried making this work with Vue 2 using the following code as per the Inertia documentation:

import Vue from 'vue'
import { createInertiaApp } from '@inertiajs/inertia-vue'

createInertiaApp({
  resolve: name => require(`./Pages/${name}`),
  setup({ el, App, props }) {
    new Vue({
      render: h => h(App, props),
    }).$mount(el)
  },
})

But I'm seeing the following console error:

Uncaught (in promise) Error: Cannot find module './undefined'

I'm assuming this could be an issue where the statamic/inertia adapter isn't communicating the path for the components?

Thanks!

luke-parallax avatar Aug 31 '21 08:08 luke-parallax

I'm also seeing this error when I try and follow the docs for Vue 3 - so I don't think it's related to Vue

luke-parallax avatar Aug 31 '21 09:08 luke-parallax

Are your views inside of a resources/js/Pages directory?

hotmeteor avatar Aug 31 '21 20:08 hotmeteor

@hotmeteor Yes, my collection is called Pages and my Blueprint is called Homepage

I've tried resources/js/Pages/Homepage.vue & resources/js/Pages/Pages/Homepage.vue and both return the above error

luke-parallax avatar Aug 31 '21 20:08 luke-parallax

Hm. Can you share your app.js and Homepage.vue files?

hotmeteor avatar Sep 01 '21 14:09 hotmeteor