Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create manifest.webmanifest in a sub directory of public #143

Open
rafaelragib opened this issue Mar 20, 2024 · 3 comments
Open

Create manifest.webmanifest in a sub directory of public #143

rafaelragib opened this issue Mar 20, 2024 · 3 comments

Comments

@rafaelragib
Copy link

Greetings,

Firstly, I want to express my gratitude for the outstanding plugin you've developed. It has greatly enhanced my project's functionality.

Issue Overview:

I've encountered a challenge while utilizing the vite-pwa nuxt 3 plugin within my project. In my project's public folder, I have a subdirectory designated for displaying various assets. However, my reverse proxy setup is configured to deny access to all other subdirectories except this designated one.
Upon running the Nuxt build process, the plugin generates the following output structure:

  • .output
    • public
      • subdirectory
        • favicon.ico
        • sw.js
        • workbox.js
      • manifest.webmanifest

While I've successfully managed to configure the service worker (sw.js) and the Workbox file (workbox.js) to be served from the subdirectory by incorporating the following configuration in nuxt.config.js:

workbox: {
  swDest: '/public/subdirectory/sw.js'
}

However, the challenge arises when attempting to automatically generate the manifest.webmanifest file within the subdirectory during the manifest generation process facilitated by the plugin.
I am unable to locate any configuration options within the plugin's documentation that would allow me to specify the output directory for the manifest file.
Any sort of guidance or assistance in resolving this issue would be really helpful.

@userquin
Copy link
Member

Dont change web manifest and sw location, the sw scope cannot be outside the subfolder (you will need to add service-worker-allowed: / http header or similar). The icons can be in any subfolder.

@rafaelragib
Copy link
Author

all of the files (nuxt script, icons, assets) are in the subdirectory file. I don't think it will be an issue to serve it from the subdirectory.

@userquin
Copy link
Member

The .output/public folder is your app's root context, Vite/Nuxt will copy your public folder assets to that folder (preserving subfolders structure): the sw is under subdirectory path. The sw.js request is <base>/subdirectory/sw.js, the browser will prevent that sw to be installed with scope <base>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants