eidellev / inertiajs-adonisjs

279 stars 17 forks source link

What does the manifest.json file in the public/assets folder do? #77

Closed MichaelNZ85 closed 2 years ago

MichaelNZ85 commented 2 years ago

Hi, I set up an app using Vue 3 with Vite and Inertia using your config. However, I kept getting a message "Manifest file could not be read". I'm guessing it hadn't been automatically created for some reason. Everything worked fine though.

I created a manifest.json file at public/assets with simply an empty JSON object and the message went away. So what does that file do and what is the point of it?

eidellev commented 2 years ago

Hi @MichaelNZ85 manifest.json is generated by Webpack Encore and is used for cache busting amongst other things.

Inertia uses it for automatic asset refreshing. You can read more about it here: https://github.com/eidellev/inertiajs-adonisjs#asset-versioning and here: https://inertiajs.com/asset-versioning

In your case, you can totally skip it by removing/replacing this line:

Inertia.version(() => Inertia.manifestFile('public/assets/manifest.json'));

in start/inertia.ts.

Hope this answers your question. Feel free to reach out if you'd like to follow up on this.

P.S. I'd be very happy if you could share your experience with setting up inertia with vite in the form of a PR :-)