-
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
Make it easier to use a custom Webpack SW bundle with the plugin #933
Comments
@jeffposnick this can be closed given the workbox-sw changes no just being a loader |
I'd like to leave this open, as there are still some ergonomic issues around automatically opting-out of using the CDN copy of Workbox if we see a signal that a custom build is being used. |
@jeffposnick could you provide a little more info. My understanding is that to opt out of the CDN from webpack the following would happen:
|
There's not a huge amount of code that needs to be changed, but there's currently some awkwardness due to assumptions being made in the webpack plugin, roughly around workbox/packages/workbox-webpack-plugin/src/index.js Lines 123 to 128 in f743aa9
The webpack plugin currently uses the presence/absence of
|
The only thing I ask is that we have consistency across behaviours in webpack, workbox-build and workbox cli. |
I personally like symmetries between different parts of a software and I think the following flow is not far-fetched.
I think this scenario is viable and more familiar to devs. |
I like the sound of this proposal and I'm thinking that for injectManifest in workbox build and CLI, they could follow this pattern of adding an All of this SGTM, but I do recall me and @jeffposnick discussed this approach (or something similar) around adding the |
As discussed in the closed linked issue, FWIW I'm not taking a view on this myself, but I'd like to be in a position to use Workbox 3 with clients of mine. I have a feeling that that may be a common option. I rather think that it might be better for CDN usage to be opt-in rather than default behaviour. I just noticed @gauntface's comment:
I do think that ideally, not using the CDN should just work ™️ . i.e. As it does with Workbox 2.0. Going on the link @gauntface shared it sounded like opting out of the ceremony not as simple as toggling Would you consider taking a look at this? One of the things I've liked so much about Workbox so far is that it's easy to get going with. From the sounds of it Workbox 3 is going to be harder to get going with if you're not going to be using the CDN. If so I think that's a real shame. |
@johnnyreilly it's not going to get harder (this was an issue with V2). Sadly the docs for build and webpack and just reference docs and are lacking pretty badly but Jeff is working on some of that stuff as I type this. My understanding from the source code is that: 1.) If you are generating a service worker, i.e. you have no 2.) If you DO set a |
@gauntface - thanks for the clarification. That sounds perfect! |
Having let the feedback here percolate a bit, I wanted to move forward with a summary and proposal. ProblemThere are three equally valid sources that a developer using the
Choosing between 1. and 2. is something that developers using the Proposal
Open Questions
CC: @johnnyreilly @goldhand @gauntface @anilanar for thoughts. |
Could we have Regarding the string, I think it's fine, but we should provide a logical error message if a invalid value, whether its Reasoning: I would like us to bring things together again, doing different actions across these tools is a bad route to take. |
I'm cool with using But, to clarify, are you fine with allowing a chunk name as a valid |
I think that's a good shout.
It's not a feature I plan to use but I've no objection to it. Though what if there's a chunk name of
Could you clarify what this means exactly? What would be the point of doing that / the impact of doing that? Also, supplying an option of |
@jeffposnick I honestly don't understand what a "chunk name" means so I have no opinion on this. 👍 Use case is largely for - I want to create a single bundle of my code and it'll be all minified but I want to inject a manifest and I'll provide a custom regex injection etc. |
Thanks for sharing @gauntface
By manifest I'm assuming you mean one of these?:
Could you tell me what you mean by this please? Feels like something I should understand but I don't |
in workbox-build at the moment we don't have self.__precacheManifest (although I wish be did), instead it looks for workbox.precache.precacheAndRoute([]) and injects the array of files there (replacing []). We've allowed the ability to custom this regex to inject else where. It's fair from ideal in v3 and one area I'd like to re-think in V4, but now it's where we are. |
Ah I see - thanks |
I think we have consensus. I'm going to put together a PR that:
|
@jeffposnick you suggested to continue #802 here, with you proposal above it seems that one can only import single chunk (the workbox) but can't import any other chunks.
@gauntface you might want to take a look at
|
That sounds like it should be tracked separately, yes. Sorry to ping-pong from issue to issue, but I think what you're describing might require a completely new config parameter, like |
@anilanar brought up the following in #808 (comment). (Please correct me if there's any nuance missing.)
The text was updated successfully, but these errors were encountered: