gdborton / webpack-parallel-uglify-plugin

A faster uglifyjs plugin.
466 stars 34 forks source link

Add explicit sourceMap option. #23

Closed Tonkpils closed 7 years ago

Tonkpils commented 7 years ago

devtools doesn't allow setting some options that the plugins provide. This checks for the currently available source map plugins in the configured plugins to ensure we use the SourceMapSource instead

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-2.004%) to 67.626% when pulling 99a810bdf41a29e5726a7cd02f724e49405ab471 on Tonkpils:fix-sourcemaps into 8c410e2eabd3aa476b19e5599658cd846f4d9277 on gdborton:master.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-2.004%) to 67.626% when pulling 99a810bdf41a29e5726a7cd02f724e49405ab471 on Tonkpils:fix-sourcemaps into 8c410e2eabd3aa476b19e5599658cd846f4d9277 on gdborton:master.

Tonkpils commented 7 years ago

@gdborton I can try to write some tests for the processAssets function but there's no current coverage on them.

Tonkpils commented 7 years ago

@gdborton let me know if there's anything I can do to help get this merged!

gdborton commented 7 years ago

@Tonkpils Thanks for the PR! Instead of using the names of the constructors could we import webpack and check for actual plugin instances? How do other libs do this detection?

Tonkpils commented 7 years ago

Instead of using the names of the constructors could we import webpack and check for actual plugin instances?

I'm not sure that comparing two different instances would yield equality. I can test it out and see if it works. We'd also need to bring in webpack as a dependency to pull the plugins out which would require us to specify which versions of webpack are supported though I doubt they would remove/add more sourcemap plugins but it'd still be good to specify it in the package.json.

How do other libs do this detection?

I actually looked around to see what other plugins I could find with similar functionalities but was not able to find something that resembled this. If you have an idea, I'd be happy to take a look at it.

gdborton commented 7 years ago

Actually thinking about this further, I don't think this is the correct way to go... By including the plugins individually you're able to provide a test/include/exclude config. https://webpack.js.org/plugins/source-map-dev-tool-plugin/

If we want to check for the presence of the source map plugins we'd also have to track which bundles are not getting filtered through their config.

The best way to go on this might be to include the same sourceMap option that is on the UglifyJSPlugin provided by webpack - https://github.com/webpack-contrib/uglifyjs-webpack-plugin#options

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 93.277% when pulling 63ebd590aa0f57b55d2873086c02d11f37890755 on Tonkpils:fix-sourcemaps into 61cc65d6f33f1d81970b1f9cc99de3fb3fb717e9 on gdborton:master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 93.277% when pulling 787f8b7604eeb3e3a66a8fbd647314cfae818359 on Tonkpils:fix-sourcemaps into 61cc65d6f33f1d81970b1f9cc99de3fb3fb717e9 on gdborton:master.

Tonkpils commented 7 years ago

@gdborton I've changed it to your suggestion of using the uglifyJS.sourceMap option and added some tests. Let me know if it looks good, however this would break current functionality of using devtool. We could maintain backwards compatibility by still checking devtool first but it's up to you if you want to to do that.

Let me know and I'll add it back in

coveralls commented 7 years ago

Coverage Status

Coverage increased (+1.7%) to 94.958% when pulling 4daf419cec97a1542e76ca126afb738661e76d4f on Tonkpils:fix-sourcemaps into 61cc65d6f33f1d81970b1f9cc99de3fb3fb717e9 on gdborton:master.

gdborton commented 7 years ago

@Tonkpils Thanks for the contribution! I went ahead and altered your commit to move the sourceMap option up, and updated the README. I've got a few more breaking changes in the pipeline, so this won't be released right away.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+1.7%) to 94.958% when pulling d71676e68481c2a05f53750bbb9ceded99c49136 on Tonkpils:fix-sourcemaps into 79c7115b64b8db28e31de8b4ac0181daf9879e64 on gdborton:master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+1.7%) to 94.958% when pulling d71676e68481c2a05f53750bbb9ceded99c49136 on Tonkpils:fix-sourcemaps into 79c7115b64b8db28e31de8b4ac0181daf9879e64 on gdborton:master.

Tonkpils commented 7 years ago

Thank @gdborton, I had been swamped and wasn't able to give this the attention it deserved. Appreciate you finishing taking over it! 🎉