nuxt icon indicating copy to clipboard operation
nuxt copied to clipboard

Can't I modify the href in the manifest file?

Open ghost opened this issue 10 months ago • 5 comments

The baseUrl on my website is '/gb' Deploying through nginx.

I installed @vite-pwa/nuxt and created a manifest in the pwa option of nuxt.config.ts.

And I added the <VitePwaManifest/> component to the app.vue.

If you look at the developer tool on the site you distributed

You can see that it is inserted into the head as shown.

Naturally, the browser is unable to find the manifest file...

I'm going to put it on the head of nuxt.config.ts' app option

When filled in, the manifest file is located well on the distributed site.

When using VitePwaManifest, is there an option that matches the same as baseUrl?

Or is it something I can't find?

I wish I could modify the path of href.

Please help me :[

ghost avatar Feb 05 '25 02:02 ghost

Are you changing the base URL at runtime? Pwa needs base at build time, you can use the base pwa option.

userquin avatar Feb 05 '25 11:02 userquin

Are you changing the base URL at runtime? Pwa needs base at build time, you can use the base pwa option.

Thank you for your response. It's written in nuxt.config.ts as follows

app : { baseURL : process.env.NUXT_PUBLIC_APP_BASE_URL },

... ... ...

pwa : { base : '/gb' }

I tried to apply the solution you gave me, but it still doesn't seem to find it..

If you go to the distributed site and check the head Still

href="/gbmanifest.webmanifest"

It's written like this.

If you change this directly to href="/gb/manifest.webmanifest" in the developer tool, an installation icon will be created in the address window

What's the problem...

ghost avatar Feb 05 '25 14:02 ghost

can you try with base: '/gb/'? Looks like a bug on the vite-plugin-pwa or here...

userquin avatar Feb 05 '25 14:02 userquin

Anyway, I'll try to add support for dynamic base url for nuxt via custom client (dev and build)

userquin avatar Feb 05 '25 15:02 userquin

Anyway, I'll try to add support for dynamic base url for nuxt via custom client (dev and build)

Oh, as you said, base: '/gb' is written normally in the head of the deployment site

ink rel="manifest" href="/gb/manifest.webmanifest" It is well inserted into.

Thank you so much.

ghost avatar Feb 05 '25 23:02 ghost