Webpack and the new build system

Yesterday I had the chance to play with the new build system in Licode version 4. Migrating from Java compiler to Google Closure Compiler and using Gulp as the build system is great. The new part for me was Webpack, so I spent a time to lean more about it:

If you’re building a complex Front End™ application with many non-code static assets such as CSS, images, fonts, etc, then yes, Webpack will give you great benefits.

If your application is fairly small, and you don’t have many static assets and you only need to build one Javascript file to serve to the client, then Webpack might be more overhead than you need.

Read more here: https://blog.andrewray.me/webpack-when-to-use-and-why/

IMO using Webpack for Erizo Client with a few number of files, as the above article clarifies, is completely unnecessary. I can see a noticeable increase in the output file size white it has increased the complexity and overhead. Also the development and debugging has been much harder than before since you need to build every time you made a change in the code. The worst thing about Webpack is that it forces the change of the syntax (i.e. export/import statements) so you would never be able to return back to the legacy style of including and merging files.

In the other hand I think Licode as a platform should avoid adding dependencies as much as possible, because of ease of use and maintenance as well. Yesterday I tried to build Erizo Client separately in my Windows to commit a feature but I failed, and I am sure the same will happen for many users in the future. If we want to encourage developers to contribute then we must simplify this by avoiding forcing them to learn lots of irrelevant concepts.

I’m sorry you see Webpack as an unnecessary addition.

In our experience it resolved some weird issues and, despite of having resolved some incompatibilities, we’re now really happy with it. Webpack is already being used by many libraries, including Socket.IO for instance. That’s true that lib size increased, but we think that’s a small price to pay for having a tool that knows about latest JS advances and that let us having the code well structured.

As an example I don’t use the provided old player in the client but I can’t find a way to not include some files in the new build system. Please build the player as a separate file at least :confused: