feat(frontend): allow configuring assets url

This commit is contained in:
sam 2025-03-17 22:46:44 +01:00
parent f5f0416346
commit f00f5b400e
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
3 changed files with 16 additions and 0 deletions

View file

@ -21,6 +21,7 @@
"@types/markdown-it": "^14.1.2",
"@types/sanitize-html": "^2.13.0",
"bootstrap": "^5.3.3",
"dotenv": "^16.4.7",
"eslint": "^9.17.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.46.1",

View file

@ -72,6 +72,9 @@ importers:
bootstrap:
specifier: ^5.3.3
version: 5.3.3(@popperjs/core@2.11.8)
dotenv:
specifier: ^16.4.7
version: 16.4.7
eslint:
specifier: ^9.17.0
version: 9.17.0

View file

@ -1,5 +1,14 @@
import adapter from "@sveltejs/adapter-node";
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
import * as path from "node:path";
import { config as dotenv } from "dotenv";
dotenv({
path: [path.resolve(process.cwd(), ".env"), path.resolve(process.cwd(), ".env.local")],
});
console.log(process.env.NODE_ENV);
const isProd = process.env.NODE_ENV === "production";
/** @type {import('@sveltejs/kit').Config} */
const config = {
@ -21,6 +30,9 @@ const config = {
// we only disable it during development, during building NODE_ENV == production
checkOrigin: process.env.NODE_ENV !== "development",
},
paths: {
assets: isProd ? process.env.PRIVATE_ASSETS_PREFIX || "" : "",
},
},
};