Yarn V4 using env variable in yarnrc

I’m using yarn v4 workspaces and need to be able to add an NPM token to access a private package.
Locally this works fine as I can either define a .env.yarn file or add it to my .env file and use the injectEnvironmentFiles array in yarnrc (Settings (.yarnrc.yml) | Yarn).
However, when trying to inject the .env file on vercel I get this error:

Internal Error: ENOENT: no such file or directory, open '/vercel/path0/.env.'

What is the correct way to handle this?