52 lines
1.3 KiB
Django/Jinja
52 lines
1.3 KiB
Django/Jinja
{% if frontend_adapter == 'bun' -%}
|
|
import adapter from "@sveltejs/adapter-bun";
|
|
import { sveltekit } from "@sveltejs/kit/vite";
|
|
import tailwindcss from "@tailwindcss/vite";
|
|
import { defineConfig } from "vite";
|
|
|
|
const PATH_SEP = /[/\\]/;
|
|
{%- else -%}
|
|
import adapter from "@sveltejs/adapter-static";
|
|
import { sveltekit } from "@sveltejs/kit/vite";
|
|
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
|
|
import tailwindcss from "@tailwindcss/vite";
|
|
import { defineConfig } from "vite";
|
|
{%- endif %}
|
|
|
|
const allowedHosts = process.env.ALLOWED_HOSTS
|
|
? process.env.ALLOWED_HOSTS.split(",")
|
|
: undefined;
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
tailwindcss(),
|
|
sveltekit({
|
|
{%- if frontend_adapter == 'bun' %}
|
|
adapter: adapter(),
|
|
compilerOptions: {
|
|
runes: ({ filename }) =>
|
|
filename.split(PATH_SEP).includes("node_modules") ? undefined : true,
|
|
},
|
|
{%- else %}
|
|
adapter: adapter({
|
|
assets: "build",
|
|
fallback: "index.html",
|
|
pages: "build",
|
|
precompress: false,
|
|
strict: false,
|
|
}),
|
|
preprocess: [vitePreprocess()],
|
|
{%- endif %}
|
|
}),
|
|
],
|
|
server: {
|
|
allowedHosts,
|
|
proxy: {
|
|
"/api": {
|
|
changeOrigin: true,
|
|
target: process.env.API_PROXY_TARGET ?? "http://localhost:8080",
|
|
},
|
|
},
|
|
},
|
|
});
|