It is expected API keys will be used server-side. That is, you should not reference them anywhere in your client-side code, but make requests to a server to get the information from the API.
// Server
app.get('/', (req, res) => {
const myApiKey = process.env.SECRET;
const thirdPartyData = ThirdPartyFunc(myApiKey); // Fetches data
res.json(thirdPartyData); // Sends back data. NOT SECRET
});
// Client
const data = await (await fetch('https://my-server.com/')).json();
// Use data...