live_svelte/example_project/assets/vite.config.mjs
2026-03-19 12:43:32 -07:00

41 lines
1.1 KiB
JavaScript

import { defineConfig } from "vite"
import { svelte } from "@sveltejs/vite-plugin-svelte"
import liveSveltePlugin from "live_svelte/vitePlugin"
import tailwindcss from "@tailwindcss/vite"
import { fileURLToPath } from "url"
import path from "path"
const __dirname = path.dirname(fileURLToPath(import.meta.url))
export default defineConfig({
server: {
host: "127.0.0.1",
port: 5173,
strictPort: true,
cors: { origin: "http://localhost:4000" },
},
optimizeDeps: {
include: ["live_svelte", "phoenix", "phoenix_html", "phoenix_live_view"],
},
ssr: { noExternal: process.env.NODE_ENV === "production" ? true : undefined },
build: {
manifest: false,
ssrManifest: false,
rollupOptions: {
input: ["js/app.js", "css/app.css"],
},
outDir: "../priv/static",
emptyOutDir: true,
},
resolve: {
alias: {
"@": ".",
live_svelte: path.resolve(__dirname, "../../assets/js/live_svelte/index.ts"),
},
},
plugins: [
tailwindcss(),
svelte({ compilerOptions: { css: "injected" } }),
liveSveltePlugin({ entrypoint: "./js/server.js" }),
],
})