nklayman / vue-cli-plugin-electron-builder

Easily Build Your Vue.js App For Desktop With Electron
https://nklayman.github.io/vue-cli-plugin-electron-builder/
MIT License
4.12k stars 280 forks source link

Are .env and .env.local files placed directly under the project root packed in the built product file? #1936

Closed kurohoan closed 1 year ago

kurohoan commented 1 year ago

Are .env and .env.local files placed directly under the project root packed in the built product file?

MatthijsBurgh commented 1 year ago

I don't know

kurohoan commented 1 year ago

Is this also under the jurisdiction of electron-builder?

MatthijsBurgh commented 1 year ago

Yes, most features of electron-builder can just be configured in the vue.config.js (see https://nklayman.github.io/vue-cli-plugin-electron-builder/guide/configuration.html#configuring-electron-builder). This project just forward this configuration to the builder. I doesn't do anything to it. So when something is not working, the issue is in your configuration or in the builder.

For this issue, I have found the following link: https://stackoverflow.com/questions/63001117/how-to-read-from-env-file-in-electron-builder-yaml-config-file. To me it seems the ENV file variables can be used in a config file/object. This project provides a configuration object to the builder based on the config in vue.config.js. So you should be able to use the values from the ENV file in vue.config.js. Based on the same assumption I THINK the ENV file is not packed, as it is only used in configuring the build.

kurohoan commented 1 year ago

Thank you!