re: Feature toggles in the front-end - useful pattern or delivering dead code? #discuss! VIEW POST

FULL DISCUSSION
 

You're always delivering dead code to some extent. Most users won't use every single feature of your site, so part of that code will be unused. Just see how big of a difference it makes in the size of your JavaScript, and if it's a big difference, load the JavaScript that's needed for this feature asynchronously. Most JavaScript build tools, like webpack, have functionality for code splitting built-in.

 

I kind of hear you. Yesterday’s code is already dead code. But I do think that having metrics (like what I shared in my most recent article) help to avoid this problem you identified:

Most users won’t use every single feature of your site

code of conduct - report abuse