1

OK, trying to move our Vuetify app to L8, Jetstream and the inertia stack. I see this line in ./resources/js/app.js

const app = document.getElementById('app');

It's grabbing the app element in the DOM.
My question is --- what defined the app.

In my L7 app, it's defined in the single blade.php

    <!-- Styles -->
    <link href="{{ asset('css/app.css') }}" rel="stylesheet">
</head>
<body>
    <div id="app"></div>
    <script src="{{ asset('js/app.js') }}" defer></script>
</body>

I can't find it in L8 and this gets this....

initialPage: JSON.parse(app.dataset.page),

[Vue warn]: Error in render: "SyntaxError: Unexpected token u in JSON at position 0"

Thanks, Jim in Florida

Jim Dunn
  • 206
  • 3
  • 8
  • Hi, interesting, not sure if this might be of interest https://stackoverflow.com/questions/46613243/uncaught-syntaxerror-unexpected-token-u-in-json-at-position-0 – IronMan Sep 21 '20 at 04:28
  • Thanks for the thought. I was there a few days ago. – Jim Dunn Sep 21 '20 at 14:29
  • which blade.php is your L7 app pointing to? There is a possibility you would need to redefine the Inertia root view. In that case, see this question: https://stackoverflow.com/questions/63926485/change-inertiajs-laravel-default-rootview – Sidney Gijzen Sep 22 '20 at 10:25
  • OK, my web.php routes file contains: Route::get('/{any}', 'SpaController@index')->where('any', '^(?!nova).*$'); and that sends me to the spa.blade.php as I have 5 SPA routes defined in my routes.js file. The spa.blade.php is shown in the first code example above, thanks. – Jim Dunn Sep 23 '20 at 11:51

1 Answers1

0

Its defined by inertia $rootView

file: Middleware/HandleInertiaRequests.php

...
protected $rootView = 'app';

where 'app' means app.blade.php inside your view folder where you should have the @inertia directive

Caio Wilson
  • 353
  • 2
  • 12