Custom Shader and lighting code


I just discovered about Three.js Shader chunks and it looks like it is a good approach for custom shader, avoiding to redevelop everything and allowing to reuse some components.

However, when I look at the example, such as this one (which does not look old), everything related to lighting is copy/pasted (the directional, pointlight, and hemisphere lights).

Is there a way to do it in a “better” way?