ConnectProject / mavoix-panel

0 stars 1 forks source link

Can't update quasar app to v2: process.env becomes undefined #75

Closed ntraut closed 3 years ago

ntraut commented 3 years ago

When trying to update quasar app to v2 following the instruction from there, mavoix-panel is no longer working because Parse fails to initialize due to environment variables not passed to the script src/boot/parse.js. I tried many different ways to pass the environment variable by replacing the current way which is with the @quasar/dotenv extension but none of them worked. Curiously, I was able to update quasar app to v2 in mavoix app. I also tried to update the maximum of packages dependencies without more success. I created this branch with minimal transformation to show that it's not working: https://github.com/ConnectProject/mavoix-panel/tree/quasar-app2

ntraut commented 3 years ago

I tried to reupdate quasar app in mavoix app using exactly the same procedure and it worked without problem. In mavoix-app:

git checkout 9070f90601b3687684a1d828f17892c3cec913ba
npm install
npm install "@quasar/app"@^2

When doing quasar dev we can see that the Parse url of the .env file is read by the quasar app. Doing exactly the same in mavoix-panel produces the bug so there is definitely something weird...

ntraut commented 3 years ago

I finally found the reason of the problem, destructuring process.env doesn't work well with webpack, so this line was not working: https://github.com/ConnectProject/mavoix-panel/blob/79adc103790120a3fa5438bd235480ad0ac45d9a/src/boot/parse.js#L13 https://github.com/webpack/webpack/issues/5392