Skip to content
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 config property of InjectManifest class protected instead of private` #3039

Closed
DibyodyutiMondal opened this issue Mar 8, 2022 · 3 comments · Fixed by #3056
Closed
Assignees
Labels
TypeScript Issues related to our TypeScript annotations. workbox-webpack-plugin

Comments

@DibyodyutiMondal
Copy link
Contributor

Library Affected:
workbox-webpack-plugin

Issue or Feature Request Description:
So, I am making a plugin that allows me to use workbox with angular, and I use typescript. Even my webpack config uses typescript.
As part of this effort, I use a class that inherits from InjectManifest.
I need to add index.html and manifest.webmanifest to additionalManifestEntries. This addition needs to be done not just during the initial webpack config setup. Rather, it must be done every time compilation runs (which is every time I make a change and save), so that I can add the compilation hash as the revision number for the two entries. This lets the existing service worker know that some file has changed somewhere, without having to add any lazy-loaded modules to the manifest entries.

For this, I need access to the config property of the InjectManifest class which I inherit from, but it is marked as private, so I cannot access it.
As illustrated by my example above, this is poor for extensibility. If possible, I recommend making it protected instead of private. That way, it remains private. But those who want to extend the behavior of the plugin can do so easily.

Currently, the workaround for this is to go into the node_modules folder and manually edit the .d.ts. This has enabled me to successfully finish my plugin, but I will have to keep returning to this whenever a new version of workbox releases.

@DibyodyutiMondal
Copy link
Contributor Author

Should I just go ahead and submit a pull request for this?

@jeffposnick
Copy link
Contributor

I can't imagine many folks will end up needing this, but sure, if it helps your use case, it seems fine. Please file a PR.

If you could also update

private config: GenerateSWConfig;
in your PR, that would be cleanest, to keep InjectManifest and GenerateSW consistent.

@DibyodyutiMondal
Copy link
Contributor Author

DibyodyutiMondal commented Jul 24, 2022

@jeffposnick Any idea when changes will propagate to npm?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TypeScript Issues related to our TypeScript annotations. workbox-webpack-plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants