How to get a warning on undefined module use?

Yeah, I found this behavior shocking when I learned about it. The bottom line seems to be that an original BEAM core design is to support a highly dynamic runtime environment; where code can be swapped in and out (“dynamically loaded”). And the issue is, we’re using this system for a whole new set of kinds of apps which are static in nature. E.g., a CRUD Phoenix web app probably is designed to work only with the modules packaged with it at deploy time. And a static code update is easy in the modern era when we can e.g. re-deploy instantly to Heroku without any downtime.

Personally, I’d appreciate a way to flag my app as “non-dynamic”, and then get linking errors at compilation time.

I bumped into your problem in a different context: I want compile errors from router.ex, but everything compiles fine. (?)

2 Likes