Enable Mounting files as well as directories
AngelMunoz opened this issue · 1 comments
Is your feature request related to a problem? Please describe.
While you can register a service worker on /assets/sw.js
or /src/sw.js
it means that these service workers can't work on /
we need to find a way to allow mounting certain files on specific URL's
Describe the solution you'd like
There should be a way to mount files (not just directories) in specific URL's and we should ensure they get copied on build, we currently kind of do that with "mountedDirectories" in perla.jsonc but we do it for complete directoriese e.g.
{
"mountedDirectories": {
"./src": "/src",
"./sw.js": "/sw.js",
"./manifest.json": "/manifest.webmanifest"
}
}
That should serve all files under ./src
and also allow ./sw.js
to be copied next to the index file, the same can be said about manifest.json, which should be copied next to the index file as well but with the new extension
Describe alternatives you've considered
In the build property we have a "copyPaths" option which could potentially fix the issue for build time but ultimately doesn't help at all when you're serving the app
Additional context
Service workers in the root are necessary to support Progressive Web Applications
this was addressed by #78, it has a slightly different solution as proposed but it can accomplish the same goals, in any case anyone feel free to re-open this one up if you feel like it