47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
import { defineConfig } from "vite";
|
|
import vue from "@vitejs/plugin-vue";
|
|
import tailwindcss from "@tailwindcss/vite";
|
|
import { VitePWA } from "vite-plugin-pwa";
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
vue(),
|
|
tailwindcss(),
|
|
VitePWA({
|
|
// Our own worker (push handlers, custom caching); the plugin builds it
|
|
// and injects the precache list of hashed assets as self.__WB_MANIFEST.
|
|
strategies: "injectManifest",
|
|
srcDir: "src",
|
|
filename: "sw.ts",
|
|
// Django owns both: the worker is served from /sw.js (root scope, not
|
|
// /static/) and the manifest is a template resolving hashed icon URLs.
|
|
injectRegister: null,
|
|
manifest: false,
|
|
devOptions: { enabled: false },
|
|
injectManifest: {
|
|
// The worker is served from /sw.js, so relative entries would resolve
|
|
// against the root; the built assets actually live under /static/.
|
|
modifyURLPrefix: { "": "/static/" },
|
|
},
|
|
}),
|
|
],
|
|
// Built assets are collected by Django and served under /static/.
|
|
base: "/static/",
|
|
resolve: {
|
|
alias: { "@": "/src" },
|
|
},
|
|
server: {
|
|
port: 5173,
|
|
strictPort: true,
|
|
// Absolute asset URLs, so the page served by Django loads them from Vite.
|
|
origin: "http://localhost:5173",
|
|
},
|
|
build: {
|
|
manifest: true,
|
|
outDir: "dist",
|
|
rollupOptions: {
|
|
input: "src/main.ts",
|
|
},
|
|
},
|
|
});
|