It does not make a difference for the portfolio weights, since the historical prices include the dividends. It could make a difference for the tax declaration, since AFAIK dividends are treated differently than profits in some countries. If dividends are distributed, reinvest them.