The following guidelines should be followed when writing a loader. They are ordered in terms of importance, and some only apply in certain scenarios:
- Simplifying the purpose of the loader
- Utilizing chaining
- Modular outputting
- Ensuring statelessness
- Employing loader utilities
- Marking loader dependencies
- Resolving module dependencies
- Extracting common code
- Avoiding absolute paths at all costs!
- Using peer dependencies
Let's go through each one in more detail, starting with simplification.