Only merge dotenv if .env file exists

This commit is contained in:
2022-08-14 20:01:51 +02:00
parent 91c75198de
commit 5f1de791c0
2 changed files with 7 additions and 6 deletions

View File

@@ -50,7 +50,6 @@
import IconSearch from "@/icons/IconSearch.vue"; import IconSearch from "@/icons/IconSearch.vue";
import IconClose from "@/icons/IconClose.vue"; import IconClose from "@/icons/IconClose.vue";
import type { Ref } from "vue"; import type { Ref } from "vue";
import config from "../../config";
import type { MediaTypes } from "../../interfaces/IList"; import type { MediaTypes } from "../../interfaces/IList";
interface ISearchResult { interface ISearchResult {

View File

@@ -13,11 +13,13 @@ const publicPath = path.resolve(__dirname, "public");
const isProd = process.env.NODE_ENV === "production"; const isProd = process.env.NODE_ENV === "production";
// Merge inn all process.env values that match dotenv keys // Merge inn all process.env values that match dotenv keys
Object.keys(process.env).forEach(key => { if (dotenv.parsed) {
if (key in dotenv.parsed) { Object.keys(process.env).forEach(key => {
dotenv.parsed[key] = process.env[key]; if (key in dotenv.parsed) {
} dotenv.parsed[key] = process.env[key];
}); }
});
}
module.exports = { module.exports = {
mode: process.env.NODE_ENV, mode: process.env.NODE_ENV,