-
Notifications
You must be signed in to change notification settings - Fork 830
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
Warn when injectManifest({runtimeCaching, navigateFallback}) is called #708
Comments
If passing one of these options to |
Warning would still be an improvement vs. silently ignoring them. The issue I have with build-time warnings is that they have trouble catching the developer's attention, especially if they're mixed in with a bunch of other build output as part of a larger pipeline. With a fatal error, you'll definitely get the developer's attention, and it forces them to take action to resolve. But we can start with |
Have you seen any developers get confused by this? |
I haven't seen issues raised or developers complaining due to confusion. |
Happy to make this display warnings, can see it being useful, but I'm 👎 on throwing an error unless it's clearly a pain point for developers. |
Okay, we'll go with the warnings approach. |
@jeffposnick can I ask why the It seems to me, being able to define caching rules in my Webpack build script can be more powerful than having to define them in a My use case is, that I want to switch the domain, depending on whether I'm building for my test environment or the prod environment. const baseDomainTemplate = '^https://{SERVICE}.' + process.env.BASE_DOMAIN;
const getDomainRegex = service => new RegExp(baseDomainTemplate.replace('{SERVICE}', service));
runtimeCaching: [
{
urlPattern: getDomainRegex('feeds'),
handler: 'networkFirst'
},
{
urlPattern: getDomainRegex('profiles'),
handler: 'networkFirst'
}
] |
The idea is that if you'd like to define your service worker's behavior in your webpack config, then using the The |
I only want |
One alternative is to use Another option is to use |
Library Affected:
workbox-build
There are a few options that could be passed in to
workbox-build.injectManifest()
(either directly, or viaworkbox-cli
orworkbox-webpack-plugin
) that don't make any sense, since in that mode, we're only replacing the contents ofprecache([])
, and not making any other changes to theswSrc
file. The ones that I can think of include:runtimeCaching
navigateFallback
navigateFallbackWhitelist
but there might be others—as part of #695 I might come across more.
Instead of silently ignoring them, leading to developer confusion when they don't have any effect, we should throw a fatal exception and explain why they shouldn't be used in the
injectManifest()
mode.The text was updated successfully, but these errors were encountered: