Yeah, so everytime you run yarn build it will generate a new yarn.lock file. Ideally you don't want that in your project. Instead you just want to run yarn to install based on the current yarn.lock file so your local and production environment install the same packages!
What is the yarn build command doing for you? It's not a standard command for yarn!
If your question is referring to a Vue SPA frontend, then you need to cd into whichever directory your frontend is in and then run the build command. Yarn will then use the lock file in your SPA portion of the site.