Enable every plugin recommended preset and replace Biome with ESLint formatting. Preserve API contracts and JSX whitespace; verify source, tests, builds and tooling.
63 lines
1.8 KiB
TypeScript
63 lines
1.8 KiB
TypeScript
import babel from "@rolldown/plugin-babel";
|
|
import react, { reactCompilerPreset } from "@vitejs/plugin-react";
|
|
import { fileURLToPath, URL } from "node:url";
|
|
import { defineConfig } from "vite";
|
|
import { VitePWA } from "vite-plugin-pwa";
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
babel({ presets: [reactCompilerPreset()] }),
|
|
VitePWA({
|
|
includeAssets: ["favicon.svg", "icons.svg", "apple-touch-icon.png"],
|
|
injectRegister: "script-defer",
|
|
integration: {
|
|
configureOptions(config, options) {
|
|
// Storybook loads this Vite config but must not install an app worker.
|
|
options.disable = config.plugins.some(plugin =>
|
|
plugin.name.startsWith("storybook:"),
|
|
);
|
|
},
|
|
},
|
|
manifest: {
|
|
background_color: "#ffffff",
|
|
description: "Личные финансы и инвестиции",
|
|
display: "standalone",
|
|
icons: [
|
|
{ sizes: "192x192", src: "/pwa-192x192.png", type: "image/png" },
|
|
{ sizes: "512x512", src: "/pwa-512x512.png", type: "image/png" },
|
|
{
|
|
purpose: "maskable",
|
|
sizes: "512x512",
|
|
src: "/pwa-512x512.png",
|
|
type: "image/png",
|
|
},
|
|
],
|
|
id: "/",
|
|
lang: "ru",
|
|
name: "WealthLedger",
|
|
scope: "/",
|
|
short_name: "WealthLedger",
|
|
start_url: "/",
|
|
theme_color: "#ffffff",
|
|
},
|
|
// Let the waiting worker activate after all app windows close.
|
|
registerType: "prompt",
|
|
workbox: {
|
|
globPatterns: ["**/*.{js,css,html,woff2}"],
|
|
// Only the static shell is cached; API requests always use the network.
|
|
navigateFallbackDenylist: [/^\/api(?:\/|$)/],
|
|
},
|
|
}),
|
|
],
|
|
resolve: { alias: { "@": fileURLToPath(new URL("src", import.meta.url)) } },
|
|
server: {
|
|
proxy: {
|
|
"/api/": {
|
|
target: process.env.API_PROXY_TARGET ?? "http://localhost:3000",
|
|
},
|
|
},
|
|
},
|
|
});
|