Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

syntactical's avatar

Inertiajs: Vue Components not rendering

I'm having some issue implementing Inertia into an existing application. Im able to compile the mix assets and load the default blade template no problem but my components dont seem to be rendering correctly. The setup is for the most part exactly as outlined in the inertia docs with some slight variations to account for the existing projects structure. There are no error logs and the 'Mounted' log (from the component) is also nowhere to be found which makes me suspect the components are not being mapped properly in my current setup.

resources dir structure

resources
- js
-- vue
--- inertia
---- inertia-app.js
---- inertia-test.vue

inertia-app.js

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

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

webpack.mix.js

...
mix.js([
    "resources/js/vue/inertia/inertia-app.js",
], 'public/js').vue().version().sourceMaps();
...

inertia-test.vue

<template>
    <p>THIS IS A TEST</p>
</template>

<script>
  export default {
    mounted: function() {
      console.log('Mounted');
    }
  }
</script>

rendered blade template

<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <link href="/css/app.css?id=3a479dde74cc2b520b46" rel="stylesheet">
    <script src="/js/inertia-app.js?id=e3e5e13afc8146300d50" defer=""></script>
  </head>
  <body>
    <div id="app" data-page="{"component":"inertia-test","props":{"errors":{}},"url":"\/qw8jz84\/inertia-test","version":"6bca9dd41bc5d3fd81283a1ea0fe8e16"}"></div>
  
</body>
</html>

NOTE: inspecting the /js/inertia-app.js it does seem to be loading with the vue component so maybe it is the mapping?

...
/***/ "./resources/js/vue/inertia sync recursive ^\.\/.*$":
/*!*************************************************!*\
  !*** ./resources/js/vue/inertia/ sync ^\.\/.*$ ***!
  \*************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var map = {
	"./inertia-app": "./resources/js/vue/inertia/inertia-app.js",
	"./inertia-app.js": "./resources/js/vue/inertia/inertia-app.js",
	"./inertia-test": "./resources/js/vue/inertia/inertia-test.vue",
	"./inertia-test.vue": "./resources/js/vue/inertia/inertia-test.vue"
};
...
0 likes
1 reply
syntactical's avatar
syntactical
OP
Best Answer
Level 4

Burried in webpack.mix.js another compile was using mix.js([...]).extract([...]). Importing the extracted vendor files in my blade template fixed the issue.

<script src="/js/manifest.js"></script>
<script src="/js/vendor.js"></script>

It seems that if .extract() is included anywhere, even if it's passed empty params, you will need to import the above. Its probably my lack of knowledge of mix/inertia but this seems odd, id expect this to be the case if maybe I was doing mix.js([...]).extract(['vue']); but an empty extract()?

1 like

Please or to participate in this conversation.