cretueusebiu / laravel-nuxt

A Laravel-Nuxt starter kit.
https://laravel-nuxt.cretueusebiu.com
MIT License
1.15k stars 262 forks source link

production mode doesn't load layouts correctly. "Failed to mount component: template or render function not defined." #136

Closed uniquadev closed 3 years ago

uniquadev commented 3 years ago

https://github.com/nuxt/nuxt.js/issues/1929

Builded site: https://karmanhub.com/ In order to see the bug, open my builded site and try to move to a different route. (it fix when you reload the page from a route that is not the welcome one)

uniquadev commented 3 years ago

I finally reproduced the error in the development version as well

Console Error Where happen

rudolfbruder commented 3 years ago

How are you using the layouts? Can you post the layout code here please?

uniquadev commented 3 years ago

Anyway looking at the console error, seem like nuxt load the default layout instead of the home one. I don't know why..


// home layout.
<template>
  <div class="layout">
    <navbar ref="navbar"/>
    <div class="wrapper">
      <sidebar/>
      <div class="main-panel ps">
        <div class="content">
          <nuxt />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Navbar from '../components/Navbar'
import Sidebar from '../components/Sidebar'

export default {
  components: {
    Navbar,
    Sidebar
  }
}
</script>
<style lang="scss">
a {
    text-decoration: none;
    background-color: transparent;
    -webkit-text-decoration-skip: objects;
}
.nav {
    list-style: none;
}
.collapse.show {
    display: block;
}
.collapse {
    display: none;
}
.collapsing {
  position: relative; 
  height: 0;
  overflow: hidden;
  transition: height .35s ease;
}
.sidebar-mini .main-panel {
    width: calc(100% - 80px)!important;
}
</style>
<style scoped lang="scss">
.wrapper {
    position: relative;
    top: 0;
    height: 100vh;
    width: 100vw;
}
.main-panel {
  height: 100%;
  max-height: 100%;
  transition-property: top,bottom,width;
  transition-duration: .2s,.2s,.35s;
  transition-timing-function: linear,linear,ease;
  position: relative;
  float: right;
  width: calc(100% - 260px);
  transition: .33s,cubic-bezier(.685,.0473,.346,1);
  .content {
    margin-top: 90px;
    padding: 30px 15px;
    min-height: calc(100vh - 123px);
  }
}
.ps {
  overflow: hidden !important;
  overflow-anchor: none;
}
</style>
uniquadev commented 3 years ago

Alright I fully checked my workspace and I figured out the issue that was causing the error. immagine

I just commented the external script and everything now run correctly o.o