98 lines
2.6 KiB
TypeScript
98 lines
2.6 KiB
TypeScript
import { VitePWA } from "vite-plugin-pwa";
|
|
import react from "@vitejs/plugin-react-swc";
|
|
import { defineConfig } from "vite";
|
|
import path from "path";
|
|
import pkg from "./package.json" assert { type: "json" };
|
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
tsconfigPaths(),
|
|
VitePWA({
|
|
strategies: "injectManifest",
|
|
srcDir: "src",
|
|
filename: "sw.js",
|
|
registerType: "autoUpdate",
|
|
injectRegister: "auto",
|
|
// injectRegister: false,
|
|
manifest: {
|
|
name: "Salona",
|
|
short_name: "Salona",
|
|
start_url: "/",
|
|
scope: "/",
|
|
theme_color: "#000000",
|
|
background_color: "#ab25c0",
|
|
dir: "rtl",
|
|
lang: "fa",
|
|
description:
|
|
"Salona is a platform to provide innovative tools to hairdressers and beauty salons.",
|
|
display_override: [
|
|
"standalone",
|
|
"fullscreen",
|
|
"window-controls-overlay",
|
|
"browser",
|
|
],
|
|
icons: [
|
|
{
|
|
src: "pwa-64x64.png",
|
|
sizes: "64x64",
|
|
type: "image/png",
|
|
},
|
|
{
|
|
src: "pwa-192x192.png",
|
|
sizes: "192x192",
|
|
type: "image/png",
|
|
},
|
|
{
|
|
src: "pwa-512x512.png",
|
|
sizes: "512x512",
|
|
type: "image/png",
|
|
},
|
|
{
|
|
src: "maskable-icon-512x512.png",
|
|
sizes: "512x512",
|
|
type: "image/png",
|
|
purpose: "maskable",
|
|
},
|
|
],
|
|
},
|
|
|
|
injectManifest: {
|
|
globPatterns: ["**/*.{js,css,html,svg,png,ico}"],
|
|
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024,
|
|
},
|
|
|
|
devOptions: {
|
|
enabled: false,
|
|
navigateFallback: "index.html",
|
|
suppressWarnings: true,
|
|
type: "module",
|
|
},
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "./src"),
|
|
"@package.json": path.resolve(__dirname, "./package.json"),
|
|
"@appointment": path.resolve(__dirname, "./src/apps/appointment"),
|
|
"@card": path.resolve(__dirname, "./src/apps/card"),
|
|
"@new-ui": path.resolve(__dirname, "./src/apps/new-ui"),
|
|
},
|
|
},
|
|
// مهم: server settings برای dev/tunnel
|
|
server: {
|
|
host: true, // bind به 0.0.0.0 (مهم برای تونل)
|
|
port: 5173, // مطمئن شو با پورتی که تونل بهش متصل میشه یکیه
|
|
},
|
|
build: {
|
|
rollupOptions: {
|
|
external: ["workbox-window"],
|
|
},
|
|
},
|
|
define: {
|
|
"import.meta.env.VITE_APP_VERSION": JSON.stringify(pkg.version),
|
|
},
|
|
});
|