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

dcranmer's avatar

Inertia/vue named slots return "Codegen node is missing" error

I'm trying to use named slots for a modal component, but all I get is this error:

[vite] Internal server error: Codegen node is missing for element/if/for node. Apply appropriate transforms first.

It then points to the component file I use for the slot. The rest of the error in vite looks like this:

 Plugin: vite:vue
  File: /Users/plweil-sa/code/wisconsin-idea/resources/js/components/ProjectNameForm.vue
      at assert (/Users/plweil-sa/code/wisconsin-idea/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js:496:11)
      at genNode (/Users/plweil-sa/code/wisconsin-idea/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js:2474:7)
      at genNodeList (/Users/plweil-sa/code/wisconsin-idea/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js:2449:7)
      at genNodeListAsArray (/Users/plweil-sa/code/wisconsin-idea/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js:2436:3)
      at genNodeList (/Users/plweil-sa/code/wisconsin-idea/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js:2447:7)
      at genVNodeCall (/Users/plweil-sa/code/wisconsin-idea/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js:2616:3)
      at genNode (/Users/plweil-sa/code/wisconsin-idea/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js:2499:7)
      at generate (/Users/plweil-sa/code/wisconsin-idea/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js:2260:5)
      at Object.baseCompile (/Users/plweil-sa/code/wisconsin-idea/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js:5349:10)
      at Object.compile (/Users/plweil-sa/code/wisconsin-idea/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js:3001:23

Everything works fine if I use a default slot. I'm not using default or persistent layout, if that makes a difference. I've seen reports of this, often linked to layouts, but (somewhat surprisingly) haven't seen a solution.

Anyone know how to get around this?

Laravel 9, Vue 3, latest Inertia.

0 likes
3 replies
dcranmer's avatar

That workaround form the LaryAI bot (now deleted) didn't work.

dcranmer's avatar

@aarondfrancis I can't recall any specific solution for this particular incident. I wish I could try and reproduce it now, but it's too long ago for me to remember. However(!) I've run into a similar vite error several times since then (it varies a bit), and I'm pretty sure that it comes down to how you structure the slots, and whether the slots are unnecessarily complex (maybe some nesting, etc.) or contain some sort of error.

I think the best way to troubleshoot is to simplify everything down an initial named slot and keep adding named slots until the error appears.

The other thing that comes to mind is whether I was trying to use persistent layouts at the time (I've since abandoned them). But right now I am using named slots with Vue 3 and Inertia all over the place with no issues .

I hope this helps!

Please or to participate in this conversation.