-
Notifications
You must be signed in to change notification settings - Fork 823
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
Explicit GenerateSW or InjectManifest webpack modes #1143
Conversation
PR-Bot Size PluginChanged File Sizes
New Files
All File SizesView Table
Workbox Aggregate Size Plugin☠️ WARNING ☠️We are using 151% of our max size budget. Total Size: 22.14KB Gzipped: 8.85KB |
@@ -17,10 +17,8 @@ | |||
module.exports = { | |||
globFollow: true, | |||
globIgnores: ['**/node_modules/**/*'], | |||
globPatterns: ['**/*.{js,css,html}'], | |||
globPatterns: [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we keep this default and give the webpack plugin a different default?
I'm guesisng this makes the webpack plugin require no config and requires config in webpack build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's always going to be config needed in the workbox-build
(I think that's what you're asking about), because we don't know what the globDirectory
should be.
So yes, this change makes it so that you need to explicitly configure globPatterns
as well as globDirectory
when using workbox-build
directly.
It sounds like you're not in favor of that, so I'll undo that part of this PR and continue overriding globPatterns
to []
when needed, instead of the other way around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - I would like workbox-build's defaults to have the default glob patterns and i think that's the case by the time i read the whole PR but not 100%, if so merge when ever you are comfortable.
* `readFile` is configured to use `compiler.inputFileSystem._readFile` during | ||
* the run phase of the webpack compilation lifecycle by passing the function | ||
* to the `setReadFile` function. | ||
* A wrapper that calls readFileFn and returns a promise for the contents of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain what readFileFn is it - I'm assuming it's a webpack provided function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
I've filed google/WebFundamentals#5567 as a reminder to update the module docs to reflect this new interface and config options. |
R: @goldhand @prateekbh @gauntface
Fixes #1136
There's a lot of refactoring in this PR to move some of the internal methods in
workbox-webpack-plugin
around, and share logic between the two plugins.As part of this PR it also made sense for me to change the global default value for
globPatterns
(defined inworkbox-build
) from['**/*.{js,css,html}']
to[]
. We had introduced a number of overrides to that global default previously, and would have to introduce additional ones here, and it got to the point that defaulting everything to[]
seemed cleaner. (Developers going through theworkbox wizard
onboarding flow won't be affected by this change, since they're explicitly asked which file extensions to precache.)Assuming this PR is merged, I will put together a follow-up PR to reflect the changes that are needed to the relevant sections of the docs:
https://github.com/google/WebFundamentals/tree/master/src/content/en/tools/workbox/guides/_shared
https://github.com/google/WebFundamentals/blob/master/src/content/en/tools/workbox/modules/workbox-webpack-plugin.md