title: How do I optimize my app.js file when using Vuejs
body: <p>I am looking for help in understanding what are the best practices people are using for a VueJs app that is not an SPA. In my project I have multiple pages and currently I'm treating every page as an SPA. But I'm noticing that my <code>app.js</code> size is increases after adding a new page. This is what I have so far</p>
  
  <pre><code>require('./bootstrap');
  var Vue = require('vue');
  
  import GlobalMixins from './mixins/GlobalMixins'
  import VueFlashMessage from 'vue-flash-message'
  import PortalVue from 'portal-vue'
  import Treeselect from '@riophae/vue-treeselect'
  
  
  Vue.prototype.$eventHub = new Vue();        //global event bus
  
  
  Vue.mixin(GlobalMixins);
  Vue.use(PortalVue);
  Vue.use(VueFlashMessage,{
      messageOptions: {
          timeout: 7000,
          important: false,
          autoEmit: true,
          pauseOnInteract: true,
          createShortcuts: false,
      }
  });
  
  // shared components
  Vue.component('navigation', require('./components/navigation.vue').default);
  Vue.component('loader',require('./components/shared/custom_loader.vue').default);
  Vue.component('treeselect',Treeselect);
  
  //parent components only for each page
  Vue.component('goals', require('./components/goals/index.vue').default);
  Vue.component('dashboard', require('./components/dashboard/index.vue').default);
  Vue.component('twitter', require('./components/twitter/index.vue').default);
  Vue.component('trends', require('./components/trends/index.vue').default);
  Vue.component('settings', require('./components/settings/index.vue').default);
  ..........
  ..........
  ..........
  
  require('./filters');
  
  window.onload = function () {
      new Vue ({
      el: '#app'
      });
  }
  </code></pre>
  
  <p>I'm compiling my assets using <code>laravel-mix</code> and even after running <code>npm run prod</code> <code>app.js</code> size is around 2MB. How can I optimize this?</p>
  
  <p>PS: gzip compression is already enabled on my servers.</p>