-
Notifications
You must be signed in to change notification settings - Fork 822
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
Fix empty object when adding runtimeCaching custom plugins with workbox-webpack-plugin #1598
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
I signed it! |
CLAs look good, thanks! |
Hey @jeffposnick just got back to this and got some cases that the strip comments regex wouldn't work correctly like when parsing a function with url strings into it. I'm working on it and will make a push to the branch ASAP. |
@jeffposnick I ended up adding the strip-comments dependency because there are too many cases to handle when removing comments from JS code like this. The complexity impact would be kinda big. Also added the test case. I'm open to suggestions if you don't think that adding the dependency is the best approach. |
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.
Awesome—this approach looks good to me, and thanks for adding test cases!
Since this is build-time tooling, I'm not concerned about introducing the extra dependencies if they lead to correct code.
R: @jeffposnick @philipwalton
Fixes #1597
As discussed on the issue, I've used this library by Yeoman instead of JSON.stringify because it doesn't handle functions, resulting in an empty object when adding custom plugins with workbox-webpack-plugin. Also, I've made some changes and now I'm using a regex based on this one to remove comments once the object is parsed as a string.
Also added some test cases.