Whether to track build files in Git depends on your deployment strategy. If you can build during deployment, exclude build files like you would node_modules.
Deploy-from-Git workflows or WordPress.org plugin distribution may require tracking build files if no build step exists in the deployment pipeline.
For team development, use continuous integration for consistent builds rather than local builds to avoid environment-dependent variations that create hard-to-debug issues between developers.