loadable-components icon indicating copy to clipboard operation
loadable-components copied to clipboard

feat: allow overriding stats for webpack-plugin

Open Aghassi opened this issue 1 year ago • 5 comments

This change allows the end user to pass options to the stats object to override them for their given use cases. It will default to the old behavior if no opts are passed.

Closes https://github.com/gregberge/loadable-components/issues/897

Summary

Close https://github.com/gregberge/loadable-components/issues/897 in a non breaking way by allowing users to override specific stats opts, but fallback on the defaults if no opts passed.

Test plan

Open to suggestions in this department.

Aghassi avatar Aug 14 '22 00:08 Aghassi

3 points:

  1. There is a better way to write desired change in the code
const stats = compilation.getStats().toJson({
      all: false,
      assets: true,
      cachedAssets: true,
      chunks: false,
      chunkGroups: true,
      chunkGroupChildren: true,
      hash: true,
      ids: true,
      outputPath: true,
      publicPath: true,
+      ...statsOpt
});
  1. statsOpt does not sound like a good name
  2. documentation for a feature is completely missing

I would propose start with the last point to display the way you expect this feature to be used, as well as indicate a possible usecase.

theKashey avatar Aug 15 '22 00:08 theKashey

Thanks for the feedback! Let me update this with the above points.

Aghassi avatar Aug 15 '22 01:08 Aghassi

@theKashey Thanks for the feedback, I've made changes to reflect the points you made. Please let me know if you'd like me to revise anything. Also, point 1 is really neat. I forgot destructuring could work like that!

Aghassi avatar Aug 15 '22 13:08 Aghassi

Great work @Aghassi and absolutely different picture visible to the end customer - another user facing the same problem.

theKashey avatar Aug 16 '22 00:08 theKashey

@theKashey thanks! Is there anything else needed for this to be merged so we can close the issue?

Aghassi avatar Aug 24 '22 21:08 Aghassi

@theKashey We stumbled over this again internally. Any chance this PR can be merged and released? Is there any more work needed?

Aghassi avatar Oct 11 '22 21:10 Aghassi

Sorry, was a little overloaded in the recent month. Just lost track of stuff to keep my eye on.

theKashey avatar Oct 11 '22 22:10 theKashey

All good! I appreciate the work you do, just didn't want this getting lost! Thank you for your time as always.

Aghassi avatar Oct 11 '22 22:10 Aghassi