[v2] Optimize treeshaking #261
Comments
Works now? |
Now, I have invited you to my test repo - maybe it helps you to see what happend / if the config is wrong:
In the build/dev folder you find the js bundle (minified) and the css / css.min files. |
OK, I have seen it works, so I changed the title, because I cannot believe that the reduction is so less. So for me, the effort to define each page all the modules is currently higher than the benefit of saved file size. Example:
Webpack 3 build, no compression: 1.73 MB
Webpack 3 build, no compression: 1.67 MB (F7 JS+CSS already 1.53 MB) Is it considered to link CSS declarations to its components, requested by Framework7, requested by Framework7-Vue, requested by the pages? So, in addition to the default code for init. etc, load only these F7 JS and CSS which is really required ... But maybe I did something wrong? In both cases, F7/F7-Vue v2 used. |
Don't include bundle versions if you need to use some modules only. Bundle is a bundle, don't expect much of tree-shaking from there |
CSS is not related to tree-shaking, CSS inclusion is just a webpack hack |
Hi. Just wanted to share some personal experiences from latest build variants while working on optimizing nuxt7 - A F7-v2 based PWA app framework. |
This is due to not perfect tree-shaking implementation of bundlers (Webpack and Rollup). If you run Buble or Babel over the whole final bundle package instead of separate modules you will get expected tree-shaking results. But anyway in next F7 update I’ll change it by putting separate components into separate folders/files to get correct tree-shaking results |
Closing, as stable v2's have separate components for better tree shaking |
Adding Webpack as builder for the kitchen sink, tree shaking does not work, all the F7 / F7-Vue code exists in later bundles, even is I reference only one page. Configuration according https://webpack.js.org/guides/tree-shaking/
The text was updated successfully, but these errors were encountered: