In this tutorial we're going to learn how we can use our.env variables inside the webpack.js config. This is perfect for the example of when you have a different javascript file based of an variable. Maybe you have a cross region application where you have a uk.js file and a us.js file, you'll use the APP_REGION environment variable to decide which javascript file to compile. https://paulund.co.uk/how-to-use-env-variables-in-webpack-js#laravel-mixIf you're using Laravel mix then there's already a nice way you can include environment variables in your javascript.
But these variables are not available in your webpack.mix.js file, therefore you can't compile your assets based off environment variables.