Hey, did you solved this? I have same issue in docker
Laravel Mix - VueJS - MIX_ env vars undefined
Hi all..
I'm coding a hybrid Laravel/VueJS site but have come across a production env issue that I wondered if it'd been experienced before? This is a brand new site using the latest versions of things (only started a couple of weeks ago).
I have 2 values in my .env file prefixed with MIX_. When I run this locally, as a dev environment, it works fine. When I build it (front end) locally as production, it works fine.
The site is pushed through my Gitlab instance and build pipeline which creates the .env file in a docker container from a Gitlab CI/CD variable. This works fine as when I login to the container, I can see the relevant values in the .env file.
Looking at the compiled app.js file, I can see there where it references both of the env vars via process.env.MIX_VAR_NAME, however, when trying to access these in the VueJS component, they're undefined (console.log() shows this and the code that uses them fails).
Has anyone else experienced this or have any idea why this might be?
Laravel mix is v5.0.5
Laravel is 7.27.0
Vue is 2.6.11
Cheers..
Ian
Please or to participate in this conversation.