It depends on the subject, of course. By the time someone has written a book on "programming language du jour" (say, Rust right now), and gotten it published and printed, it will be 1-2 years out of date. And students will complain that "all the information is online for free". Except, it's really hard to point at a specific website that is not in your (the professor's) control to say "everything you need is in here" when it could be taken offline tomorrow. Or reorganized and re-written in such a way that content is added or removed.
The course I think I did the best in teaching was to say "here is the textbook" (on databases) and then when a specific solution / technique came up, to point out that "this is how mysql does it", or "this one is used by postgres", etc.
Absolutely, and I'd like to clarify, I'm not expecting a single physics book to cover all there is to know about electricity and magnetism. I just mean for a particular course (where the purpose of the course is to expose me to the topic) to be centered around a book properly, in which new topics that aren't in the book aren't introduced (within reason of course)