Closed laszbalo closed 4 years ago
Hey,
No, thank you. This seems like a wildly dangerous idea and could (easily) render your router effectively useless. It also means that the base
parameter is meaningless, since route-patterns could now match anywhere within the entire URL. No point of a base path with that behavior.
Appreciate it though :)
Thanks for taking the time to look into this. I understand that you don't want this into your library.
Personally had similar feelings about this proposal, but for my defense, this is how Workbox actually works for same origin requests.
From their docs:
new RegExp('/styles/.*\\.css') // NOTE: The origin where Workbox is running is example.com
The above RegExp
will match all of the following URL
s:
However, I did not think through the possible implications of this change could have on people who use your library differently. (in Node.js, etc)
No worries!
Yes, but Workbox is primarily concerned with assets and directory relationships/structures, typically with extension information. As with your example, it says "any CSS files inside styles", which allows it to be anywhere so long as it's a CSS file directly within styles
.
That said, this will also match:
example.com/foo/styles/main.css/oops
But that's fine for Workbox because that doesn't/won't happen 99.999999% of the time
I am using this library to convert Express routes to
RegExp
s and then give thoseRegExp
s to Workbox. My issue is that Workbox matches the generatedRegExp
s to absolute URLs. Therefore, I added an option to optionally make the matching loose at the start as well:So,
Would you consider adding this feature to the library?