Consider a battery with internal resistance connected to an external voltage source; there is a voltage difference along the battery
The voltage source is not drawn in the picture
The voltage difference is $\ V= E ± Ir$ where ± is determined by the direction of the current flow. The symbols have their usual meanings V is the total voltage difference through the battery. As per the definition of resistance ; the resistance of some component is equal to the total voltage difference through that component divided by the total current that flows through it.
Accordingly, it would follow that $\frac{V}{r}=I$ Which is in contradiction to the aforementioned. E would be zero, which is clearly wrong
The second method implicitly assumes that the total voltage drop is only caused by the resistance alone. However to my knowledge resistance is defined as the ratio between the total voltage difference and the current that flows through it.
What is the correct definition of resistance of a component, if it is different from the above? Or is there something wrong in my reasoning?
Reading the answer I now consider the contexts where V=IR can be used as a definition for the resistance of a component. https://en.m.wikipedia.org/wiki/Electrical_resistance_and_conductance The wiki article uses “object” implying, some sort of a generality. $V$-$I$ linear OR $V=IR$ is statement of Ohm's law? Too stresses how resistance is defined.