title: All Laravel routes exposed. How to move it to app.js or minify if possible
body: <p>I am using Ziggy for my Laravel, Vue.js and Inertia js project. In the view page source, I can clearly see all of the Laravel routes.</p>
  <pre><code>&lt;script type=&quot;text/javascript&quot;&gt;
      const Ziggy = {&quot;url&quot;:&quot;http:\/\/127.0.0.1:8787&quot;,&quot;port&quot;:8787,&quot;defaults&quot;:{},&quot;routes&quot;: 
      ......
  
  &quot;sup_finish_tt_order&quot;:{&quot;uri&quot;:&quot;front\/finishorder&quot;,&quot;methods&quot;:[&quot;POST&quot;]},&quot;assign__tt&quot;:{&quot;uri&quot;:&quot;front\/assigntt&quot;,&quot;methods&quot;:[&quot;POST&quot;]},&quot;technicians&quot;:{&quot;uri&quot;:&quot;technicians&quot;,&quot;methods&quot;:[&quot;GET&quot;,&quot;HEAD&quot;]},&quot;change-password&quot;:{&quot;uri&quot;:&quot;change-password&quot;,&quot;methods&quot;:[&quot;GET&quot;,&quot;HEAD&quot;]},&quot;reset.password&quot;:{&quot;uri&quot;:&quot;c
  ----------
  &lt;/script&gt;
  </code></pre>
  <p>Is there any way to relocate this Ziggy object in app.js or make it less obvious? Based on the <a href="https://github.com/tighten/ziggy" rel="noreferrer">Ziggy</a> documentation and the answer attempted here I try importing it in app.js,a but it's not working.</p>
  <blockquote>
  <p>Uncaught TypeError: Cannot read property 'prototype' of undefined
  at Object.inherits (app.js:124712)
  at Object. (app.js:68991)
  at Object../node_modules/irc/lib/irc.js (app.js:69342)
  at <strong>webpack_require</strong> (app.js:64)
  at Object../node_modules/ziggy/index.js (app.js:140181)
  at <strong>webpack_require</strong> (app.js:64)
  at Module../resources/js/app.js (app.js:141504)
  at <strong>webpack_require</strong> (app.js:64)
  at Object.0 (app.js:142081)
  at <strong>webpack_require</strong> (app.js:64)</p>
  </blockquote>
  <p><strong>___________________________Set up ______________________________________</strong></p>
  <p>//Backend</p>
  <pre><code>$ php artisan ziggy:generate
  File generated!
  </code></pre>
  <p>//  sample /resources/js/ziggy.js file</p>
  <pre><code>const Ziggy = {&quot;url&quot;:&quot;http:\/\/127.0.0.1:8787&quot;,&quot;port&quot;:8787,&quot;defaults&quot;:{},&quot;routes&quot;:{&quot;debugbar.openhandler&quot;:{&quot;uri&quot;:&quot;_debugbar\/open&quot;  /*..... All named routes as expeted */
  
  
  if (typeof window !== 'undefined' &amp;&amp; typeof window.Ziggy !== 'undefined') {
      for (let name in window.Ziggy.routes) {
          Ziggy.routes[name] = window.Ziggy.routes[name];
      }
  }
  
  export { Ziggy };
  
  
  </code></pre>
  <p>// /resources/js/app.js</p>
  <pre><code>require('./bootstrap')
  import Vue from 'vue'
  import VueMeta from 'vue-meta'
  import PortalVue from 'portal-vue'
  import { App, plugin } from '@inertiajs/inertia-vue'
  import { InertiaProgress } from '@inertiajs/progress/src'
  
  // Ziggy start here
  import route from 'ziggy';
  import { Ziggy } from './ziggy';
  
  Vue.mixin({
      methods: {
          route: (name, params, absolute, config = Ziggy) =&gt; route(name, params, absolute, config),
      },
  });
  // ziggy end here
  
  
  
  import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'
  Vue.use(BootstrapVue)
  Vue.use(IconsPlugin)
  import 'bootstrap/dist/css/bootstrap.css'
  import 'bootstrap-vue/dist/bootstrap-vue.css'
  import { mixins } from 'vue-chartjs'
  import TreeBrowser from './Pages/globalComponents/TreeBrowser.vue'
  //Vue.config.productionTip = false
  Vue.mixin({ methods: { route: window.route } })
  Vue.use(plugin)
  Vue.use(PortalVue)
  Vue.use(VueMeta)
  Vue.component('TreeBrowser', TreeBrowser)
  InertiaProgress.init()
  
  let app = document.getElementById('app')
  
  new Vue({
      metaInfo: {
          titleTemplate: (title) =&gt; title ? `${title} - FNV` : 'FNV yours'
      },
      render: h =&gt; h(App, {
          props: {
              initialPage: JSON.parse(app.dataset.page),
              resolveComponent: name =&gt;
                  import (`./Pages/${name}`).then(module =&gt; module.default),
          },
      }),
  }).$mount(app)
  </code></pre>
  <p>// /webpack.mix.js</p>
  <pre><code>const mix = require('laravel-mix');
  const path = require('path');
  mix.js('resources/js/app.js', 'public/js')
      .sass('resources/sass/app.scss', 'public/css');
  
  mix.webpackConfig({
      resolve: {
          alias: {
              ziggy: path.resolve('vendor/tightenco/ziggy/dist'),
          },
      },
  });
  </code></pre>
  <p>usage of ziggy ex in Login.vue</p>
  <pre><code>this.$inertia.post(this.route('login.attempt'), data, {
          onStart: () =&gt; this.sending = true,
          onFinish: () =&gt; this.sending = false,
        })
      ```
  
  </code></pre>