I've set the following keys in my .env file.
AGOLIA_APP_KEY="appKey"
AGOLIA_APP_SECRET="appSecret"
AGOLIA_APP_INDEX="appIndex"
I want to access these variables in my script file agolia.js as the following.
let client = algoliasearch(
process.env.AGOLIA_APP_KEY,
process.env.AGOLIA_APP_SECRET
);
let index = client.initIndex(process.env.AGOLIA_APP_INDEX);
With the above config. Laravel mix compiles the file with success but instead of variables same string text are seen in compiled file.
I.E: process.env.AGOLIA_APP_KEY
How can I access .env variables in javascript files ? Most of the answers were about accessing in