Ionic transport phenomena in organic semiconductor materials underpin emerging technologies ranging from bioelectronics to energy storage. The performance of these systems is affected by an interplay of film morphology, ionic transport and electronic transport that is unique to organic semiconductors yet poorly understood. Using in situ electrochemical strain microscopy (ESM), we demonstrate that we can directly probe local variations in ion transport in polymer devices by measuring subnanometre volumetric expansion due to ion uptake following electrochemical oxidation of the semiconductor. The ESM data show that poly(3-hexylthiophene) electrochemical devices exhibit voltage-dependent heterogeneous swelling consistent with device operation and electrochromism. Our data show that polymer semiconductors can simultaneously exhibit field-effect and electrochemical operation regimes, with the operation modality and its distribution varying locally as a function of nanoscale film morphology, ion concentration and potential. Importantly, we provide a direct test of structure–function relationships by correlating strain heterogeneity with local stiffness maps. These data indicate that nanoscale variations in ion uptake are associated with local changes in polymer packing that may impede ion transport to different extents within the same macroscopic film and can inform future materials optimization.