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

$service-worker files exclusion improvements. Make it automatic and Configurable. #1636

Closed
hariombalhara opened this issue Jun 3, 2021 · 4 comments

Comments

@hariombalhara
Copy link
Contributor

hariombalhara commented Jun 3, 2021

Is your feature request related to a problem? Please describe.
.gitkeep file available in assets/some-dir is available in $service-worker.files causing this file to be requested unnecessarily(and surprisingly).

Describe the solution you'd like
Here I see that only one file .DS_STORE is excluded from $service-worker.files. I would suggest the following

  • All hidden files might be excluded from here by default. There might be other hidden files like vim swap and swo files
  • An option to toggle the above flag using Svelte config file, just in case someone wants to have complete control.
  • A list of files/glob patterns to specify the list of files that you would want to be excluded. This exclusion can also be helpful when you have certain files present which you are not using currently anywhere. Those files probably exist because you are experimenting with something or maybe someone just forgot to remove the file but he removed the actual usage. One more reason can be Open Graph meta tags using an image that isn't used on the website directly but is served from the website when requested.

Describe alternatives you've considered
For the time being, I have excluded .gitkeep in service-worker.ts which works for me but increases service-worker.js file size unnecessarily.

How important is this feature to you?
This is not super important. But I would love to contribute if you can provide the next step here.

Additional context
It shows a .gitkeep file being requested from service-worker
Screenshot 2021-06-04 at 12 20 40 AM

@hariombalhara hariombalhara changed the title $ServiceWorker files exclusion improvements. Make it automatic and Configurable. $service-worker files exclusion improvements. Make it automatic and Configurable. Jun 4, 2021
@benmccann
Copy link
Member

Based off the discussion in sveltejs/sapper#1095 I'm guessing that we might not want to ignore hidden files by default. But it sounds reasonable to provide an option that lets you filter which files are included / ignored

@hariombalhara
Copy link
Contributor Author

@benmccann Thanks for pointing me to the sapper issue. I searched for a similar issue in Sveltekit but couldn't find it there. I didn't think about looking into sapper issues.

I have done the changes not sure if I am in the right direction.

@ignatiusmb
Copy link
Member

This is now configurable through the serviceWorker option, thanks for the PR!

@julienchazal
Copy link

julienchazal commented Feb 5, 2022

Hello, just a little improvement request : on my Mac it's DS_Store and not DS_STORE as in default kit config
thx !

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

4 participants