@FREDEMAGI - Ok, I think I got your problem.
see your webpack.mix.js file:
mix.combine(
[
'public/js/custom/test.js'
], 'public/js/app.js')
The line where you have public/js/custom/test.js seems to be the problem. To be able to use your process.env.MIX_MY_VAR variable, you should have your JS file coming from resources/js folder, not from public.js.
The public/js should be only generated files or files moved by Mix which will not be parsed/compiled. So, your public/js/custom/test.js should actually be at resource/js/custom/test.js, then it will be compiled and your console.log(max_val) will show 1234 as expected.
If this does not happen, could you try sharing with us some more of your project structure/code so we can try to understand and help you in a better way?