Vector3.SlerpToRef function is not available in the npm package. It works with CDN version and preview mode. Problem occurs only with @babylonjs/core - npm package
Are you sure you tested a NPM package of Babylon.js 5.0?
Vector3.SlerpToRef only exists since 5.0 (committed on 2021/05/19).
Thank you Evgeni, I installed and it worked.