use vite env

This commit is contained in:
castdrian 2023-07-22 21:41:15 +02:00
parent d371321116
commit dce6dff9a1
No known key found for this signature in database
4 changed files with 94 additions and 98 deletions

View File

@ -1,3 +1,4 @@
# make sure the cors proxy url does NOT have a slash at the end # make sure the cors proxy url does NOT have a slash at the end
VITE_CORS_PROXY_URL=... VITE_CORS_PROXY_URL=...
VITE_TMDB_READ_API_KEY=... VITE_TMDB_READ_API_KEY=...
VITE_APP_DOMAIN="http://localhost:5173"

View File

@ -13,7 +13,6 @@
"core-js": "^3.29.1", "core-js": "^3.29.1",
"crypto-js": "^4.1.1", "crypto-js": "^4.1.1",
"dompurify": "^3.0.1", "dompurify": "^3.0.1",
"dotenv": "^16.3.1",
"fscreen": "^1.2.0", "fscreen": "^1.2.0",
"fuse.js": "^6.4.6", "fuse.js": "^6.4.6",
"hls.js": "^1.0.7", "hls.js": "^1.0.7",

View File

@ -5,14 +5,14 @@ import { VitePWA } from "vite-plugin-pwa";
import checker from "vite-plugin-checker"; import checker from "vite-plugin-checker";
import path from "path"; import path from "path";
import { handlebars } from "./plugins/handlebars"; import { handlebars } from "./plugins/handlebars";
import dotenv from 'dotenv'; import { loadEnv } from "vite"
dotenv.config();
export default defineConfig({ export default defineConfig(({ mode }) => {
return {
plugins:[ plugins:[
handlebars({ handlebars({
vars: { vars: {
appdomain: process.env.APP_DOMAIN, appdomain: loadEnv(mode, process.cwd()).VITE_APP_DOMAIN,
}, },
}), }),
react({ react({
@ -99,4 +99,5 @@ export default defineConfig({
test: { test: {
environment: "jsdom", environment: "jsdom",
}, },
};
}); });

View File

@ -2448,11 +2448,6 @@ dompurify@^3.0.1:
resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.0.2.tgz#bc4c7c011c825e7704341a285461d8d407d9429a" resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.0.2.tgz#bc4c7c011c825e7704341a285461d8d407d9429a"
integrity sha512-B8c6JdiEpxAKnd8Dm++QQxJL4lfuc757scZtcapj6qjTjrQzyq5iAyznLKVvK+77eYNiFblHBlt7MM0fOeqoKw== integrity sha512-B8c6JdiEpxAKnd8Dm++QQxJL4lfuc757scZtcapj6qjTjrQzyq5iAyznLKVvK+77eYNiFblHBlt7MM0fOeqoKw==
dotenv@^16.3.1:
version "16.3.1"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.3.1.tgz#369034de7d7e5b120972693352a3bf112172cc3e"
integrity sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==
eastasianwidth@^0.2.0: eastasianwidth@^0.2.0:
version "0.2.0" version "0.2.0"
resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb"