hotmeteor / inertia-statamic

An Inertia.js adapter for Statamic.
MIT License
55 stars 9 forks source link

How to use with Vue 2? #2

Open luke-parallax opened 3 years ago

luke-parallax commented 3 years ago

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 commented 3 years ago

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

hotmeteor commented 3 years ago

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

luke-parallax commented 3 years ago

@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

hotmeteor commented 3 years ago

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