@Kajrietberg Careful. It looks like you are conflating what you are trying to do at build time, and what you want to run in the client. Env vars are only available to the server.
If you need that JS to run client-side, you'd not want to populate it with your API secret. It would be exposed.