nextcloud-libraries / webpack-vue-config

This is a base webpack configuration to use with Nextcloud apps https://npmjs.org/@nextcloud/webpack-vue-config
GNU Affero General Public License v3.0
8 stars 3 forks source link

RFC: future of this package #600

Open ShGKme opened 3 months ago

ShGKme commented 3 months ago

I'd like to discuss the future of this package since we are migrating to @nextcloud/vite-config.

Current state

Issues with webpack-vue-config

  1. 🐌 It is slow and requires much RAM for production build
  2. πŸ“¦ It inject CSS into JS making impacting web performance
  3. ⛓️‍πŸ’₯ Bad extending. It just exports config which is then mutated, making it not configurable on hight-level and less stable for changes
  4. 🌲 It has an old issue with less effective Tree Shaking

These issues can be solved:

  1. Migrating from babel + ts-loader + Terser to ESBuild makes it much faster (requires even less RAM than Vite)
  2. Adding MiniCssExtractPlugin to extract CSS
  3. Adding a good support for extending and configuration similar to @nextcloud/vite-config
  4. Not solvable afaik

Also, there is RSPack, Rust-based Webpack compatible bundler.

Issue with Vite

  1. 🍴 It requires much more RAM on production build than Webpack + ESBuild
  2. πŸ”¬ It has an old problem with multiple JS entrypoints. It's optimized for building libraries and results in tons of micro-chunkswhich is bad for performance. It is not so configurable in chunk generation as Webpack. it is not a problem for typical Vite users with index.html entrypoint, but it is for Nextcloud apps
  3. πŸ”Ž Still lack of plugins. For even basic things we create our own plugins or use not widely-used ones

Some of the problem might be solved via rolldown (likely brining new in the beginning) or fixed in future.

Further options

1. Consider Vite the only recommended option

And mark this package as deprecated and maintenance-only

2. Support both

And develop a new major of nextcloud/webpack-config with some of problems solved.

skjnldsv commented 3 months ago

1. Consider Vite the only recommended option

:+1:

ShGKme commented 3 months ago
  1. Support both

πŸ‘