-
In Chart.js, tree-shaking didn’t work as expected because of assignments to class properties (replaced with static properties).
-
CodeRabbit
CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
-
(Full disclosure: this is a real-world design decision from Chartist, an open-source data visualization library I maintain and contribute to.)
-
size-limit
Calculate the real cost to run your JS app or lib to keep good performance. Show error in pull request if the cost exceeds the limit.
However, you can use the Size Limit library to control the size of a bundle or individual exports. Here’s an example configuration:
-
You can see that the div function was copied “as is” and is not used in any way. When you run Webpack in production mode, it will remove this function. (Internally, Webpack relies on Terser for minification; Rollup performs tree-shaking and dead code elimination on its own.)
-
You can see that the div function was copied “as is” and is not used in any way. When you run Webpack in production mode, it will remove this function. (Internally, Webpack relies on Terser for minification; Rollup performs tree-shaking and dead code elimination on its own.)
-
In react-chartjs-2, some exported entities are constructed by calling a factory method (marked as pure).