Electroweak-boson production in hadronic processes can be used for the investigation of the parton distribution functions (PDFs). This is particularly true in heavy-ion collisions at the LHC, where the initial state is still poorly constrained by measurements and is important for the interpretation of the evolution of the system.
The ALICE experiment can measure W and Z bosons via their leptonic decays in the electron channel at midrapidity ($|y_\mathrm{lab}| < 0.6$) and in the muon channel at forward rapidity ($-4 < y_\mathrm{lab} < -2.5$). The observations at large $y_\mathrm{lab}$ are especially important for investigating a phase space region that is largely unconstrained by other heavy-ion experiments.
This work presents the recent ALICE results on electroweak boson measurements in p--Pb collisions at $\sqrt{s_\mathrm{NN}} = 8.16~{\rm TeV}$ and Pb--Pb collisions at $\sqrt{s_\mathrm{NN}} = 5.02~{\rm TeV}$. They include production cross sections and nuclear modification factors as a function of rapidity and collision centrality. The results are compared to pQCD calculations; those showing clear evidence of nuclear modification of the PDFs will be highlighted. In addition, preliminary results on W boson production in pp collisions at $\sqrt{s} = 13$ TeV are presented.