You want Build time use .env setting context. Two way:
1. source .env
package.json > "build": "source .env && nuxt build"
2. eval $(grep '^NUXT_' .env)
package.json > "build": "eval $(grep '^PROD_' .env) && nuxt build"
^RROD_ can replace by yourself
.env file inside
PROD_API_URL=https://ooxxooxx