Do finite products commute with colimits in the category of spaces?

Here is a counterexample for the directed limit:
Let $X_n$ be a wedge of $n$ circles $C_1,\dots,C_n$. We have a sequence of closed inclusions $X_1\hookrightarrow X_2\hookrightarrow\dots$ whose colimit is $X$, a wedge of countably many circles. There is a continuous bijection $j:\text{colim}(X_n\times\Bbb Q)\to X\times\Bbb Q$ which I claim is not a homeomorphism. Namely, if $A$ is the subset of $\text{colim}(X_n\times\Bbb Q)$ whose intersection with the cylinder $C_n\times\Bbb Q$ is $$ \left\{ (e^{2\pi i x},y)\ \middle| \ \frac\pi n \le y \le \frac\pi n +\min(x,1-x)\right\} $$ then $A$ is closed, but $j(A)$ is not closed in $X\times\Bbb Q$ as $(0,0)$ is a limit point of $j(A)$.

We would have a homeomorphism, though, if $Y$ (which in the example was $\Bbb Q$) were locally compact, as that would make the functor $(-)\times Y$ a left adjoint to the functor $(-)^Y$, and left adjoints preserve all colimits.

It also works, for any $Y$, if the diagram is such that we can choose a subset $\cal S$ of the spaces in the diagram $X:\mathscr J\to\mathbf{Top}$ such that

  • every space in the diagram is either in $\cal S$ or has a map to some space in $\cal S$
  • the quotient map $\coprod_{i\in\mathscr J} X_i\to\text{colim}(X_i)$ restricts to a perfect map $\coprod_{s\in\mathcal S}X_s\to\text{colim}(X_i)$ (Note that the previous point implies that this restriction is a quotient map).

This is because for every perfect map $p:X\to Y$, the product $p\times\mathbf 1_Z:X\times Z\to Y\times Z$ is closed, thus a quotient map.