Skip to content

Conversation

@tsirlucas
Copy link
Contributor

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.

@googlebot
Copy link

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. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@tsirlucas
Copy link
Contributor Author

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

@coveralls
Copy link

coveralls commented Aug 7, 2018

Coverage Status

Coverage decreased (-0.001%) to 86.531% when pulling e3c49ad on tsirlucas:master into 096e448 on GoogleChrome:master.

@jeffposnick jeffposnick self-requested a review August 8, 2018 18:00
@tsirlucas
Copy link
Contributor Author

tsirlucas commented Aug 8, 2018

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.

@tsirlucas
Copy link
Contributor Author

@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.

Copy link
Contributor

@jeffposnick jeffposnick left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants