How to access environment variable from custom plugins

I have created a custom plugins. In the plugin I want to access an environment variable from the .env file.

In the react component I tried using process.env.<VARIABLE_NAME>

This didn’t work. Can anyone help me with this.

You can only read environment variables from server end in custom plugins instead of client end.