vite-pwa / vite-plugin-pwa

Zero-config PWA for Vite
https://vite-pwa-org.netlify.app/
MIT License
3.2k stars 209 forks source link

Manifest file is not put in the correct location #547

Open likeadeckofcards opened 1 year ago

likeadeckofcards commented 1 year ago

I am using Laravel + Vue to build an application. In order to get the service worker to generate in the correct location I am using the following configuration.

{
    injectRegister: 'null',
    outDir: 'public/',
    scope: '/',
    base: '/',
    buildBase: '/',
    workbox: {
        globPatterns: ['**/*.{js,css}'],
        navigateFallback: null,
    },
}

However this leaves the manifest.webmanifest file in /public/build/manifest.webmanifest.

I tried adding the manifest.publicPath option to the config but it doesn't work and when doing a global search of the source code I don't see any usages of it.

How would I either get the manifest.webmanifest file to be put in /public/ instead of /public/build/ or get the file url in the sw.js to use /build/manifest.webmanifest instead of /manifest.webmanifest?

userquin commented 1 year ago

@likeadeckofcards the output folder is set by the vite laravel plugin, we cannot undo the hacks done by that plugin; filter issues with laravel, there are some workaround to make it working

likeadeckofcards commented 1 year ago

@userquin I do see that there are some weird settings to the laravel plugin but it seems like the manifest file is getting put in the wrong location.

Do you have any suggestions?

userquin commented 1 year ago

@likeadeckofcards the laravel plugin is setting the Vite outDir to that folder, check my comment in this issue https://github.com/vite-pwa/vite-plugin-pwa/issues/467#issuecomment-1427998051