Fix v8 build rule to avoid unnecessary rebuilds

Review 1159 by @mlucy
Closes #1872