Access env within js application code

How we can access an environment variable from js code? in the past, it used to with dotenv-webpack or dotenv package, but with webpack/mix config no longer be found, I don’t have any idea how I can access them for storing API keys as constants.