Laravel - Compiling Assets - Environment Variables

You may inject environment variables into your webpack.mix.js script by prefixing one of the environment variables in your .env file with MIX_:


After the variable has been defined in your .env file, you may access it via the process.env object. However, you will need to restart the task if the environment variable's value changes while the task is running: