The statistical model with exact conservation of baryon number, electric charge, and strangenessthe Canonical Statistical Model (CSM) -is used to analyze the dependence of yields of light nuclei at midrapidity on charged pion multiplicity at the LHC. The CSM calculations are performed assuming baryon-symmetric matter, using the recently developed Thermal-FIST package. The light nuclei-toproton yield ratios show a monotonic increase with charged pion multiplicity, with a saturation at the corresponding grand-canonical values in the high-multiplicity limit, in good qualitative agreement with the experimental data measured by the ALICE collaboration in pp and Pb-Pb collisions at different centralities and energies. Comparison with experimental data at low multiplicities shows that exact conservation of charges across more than one unit of rapidity and/or a chemical freeze-out temperature which decreases with the charged pion multiplicity improves agreement with the data.