2023-02-22 21:15:37 +01:00
|
|
|
import { defineConfig } from "vitest/config";
|
2023-03-19 18:01:08 +01:00
|
|
|
import react from "@vitejs/plugin-react";
|
2023-01-07 21:36:18 +01:00
|
|
|
import loadVersion from "vite-plugin-package-version";
|
2023-02-24 19:23:00 +01:00
|
|
|
import { VitePWA } from "vite-plugin-pwa";
|
2023-02-19 18:03:54 +01:00
|
|
|
import checker from "vite-plugin-checker";
|
2022-12-13 23:19:07 +01:00
|
|
|
import path from "path";
|
2023-07-15 15:53:43 +02:00
|
|
|
import { handlebars } from "./plugins/handlebars";
|
2023-07-22 22:37:47 +02:00
|
|
|
import { loadEnv } from "vite";
|
2022-12-13 23:19:07 +01:00
|
|
|
|
2023-07-22 21:41:15 +02:00
|
|
|
export default defineConfig(({ mode }) => {
|
2023-07-22 22:37:47 +02:00
|
|
|
const env = loadEnv(mode, process.cwd());
|
|
|
|
return {
|
|
|
|
plugins: [
|
|
|
|
handlebars({
|
|
|
|
vars: {
|
2023-07-23 12:18:20 +02:00
|
|
|
opensearchEnabled: env.VITE_OPENSEARCH_ENABLED === "true",
|
2023-10-27 21:51:14 +02:00
|
|
|
routeDomain:
|
|
|
|
env.VITE_APP_DOMAIN +
|
|
|
|
(env.VITE_NORMAL_ROUTER !== "true" ? "/#" : ""),
|
2023-07-23 12:18:20 +02:00
|
|
|
domain: env.VITE_APP_DOMAIN,
|
2023-10-27 21:51:14 +02:00
|
|
|
env
|
|
|
|
}
|
2023-07-22 22:37:47 +02:00
|
|
|
}),
|
|
|
|
react({
|
|
|
|
babel: {
|
|
|
|
presets: [
|
|
|
|
"@babel/preset-typescript",
|
|
|
|
[
|
|
|
|
"@babel/preset-env",
|
|
|
|
{
|
|
|
|
modules: false,
|
|
|
|
useBuiltIns: "entry",
|
|
|
|
corejs: {
|
2023-10-27 21:51:14 +02:00
|
|
|
version: "3.29"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|
|
|
|
}
|
2023-07-22 22:37:47 +02:00
|
|
|
}),
|
|
|
|
VitePWA({
|
2023-12-09 15:24:01 +01:00
|
|
|
disable: env.VITE_PWA_ENABLED !== "yes",
|
2023-07-22 22:37:47 +02:00
|
|
|
registerType: "autoUpdate",
|
|
|
|
workbox: {
|
2023-12-06 19:37:51 +01:00
|
|
|
maximumFileSizeToCacheInBytes: 4000000, // 4mb
|
2023-10-27 21:51:14 +02:00
|
|
|
globIgnores: ["**ping.txt**"]
|
2023-07-22 22:37:47 +02:00
|
|
|
},
|
|
|
|
includeAssets: [
|
|
|
|
"favicon.ico",
|
|
|
|
"apple-touch-icon.png",
|
2023-10-27 21:51:14 +02:00
|
|
|
"safari-pinned-tab.svg"
|
2023-07-22 22:37:47 +02:00
|
|
|
],
|
|
|
|
manifest: {
|
|
|
|
name: "movie-web",
|
|
|
|
short_name: "movie-web",
|
|
|
|
description: "The place for your favourite movies & shows",
|
|
|
|
theme_color: "#120f1d",
|
|
|
|
background_color: "#120f1d",
|
|
|
|
display: "standalone",
|
|
|
|
start_url: "/",
|
|
|
|
icons: [
|
|
|
|
{
|
|
|
|
src: "android-chrome-192x192.png",
|
|
|
|
sizes: "192x192",
|
|
|
|
type: "image/png",
|
2023-10-27 21:51:14 +02:00
|
|
|
purpose: "any"
|
2023-07-22 22:37:47 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
src: "android-chrome-512x512.png",
|
|
|
|
sizes: "512x512",
|
|
|
|
type: "image/png",
|
2023-10-27 21:51:14 +02:00
|
|
|
purpose: "any"
|
2023-07-22 22:37:47 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
src: "android-chrome-192x192.png",
|
|
|
|
sizes: "192x192",
|
|
|
|
type: "image/png",
|
2023-10-27 21:51:14 +02:00
|
|
|
purpose: "maskable"
|
2023-07-22 22:37:47 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
src: "android-chrome-512x512.png",
|
|
|
|
sizes: "512x512",
|
|
|
|
type: "image/png",
|
2023-10-27 21:51:14 +02:00
|
|
|
purpose: "maskable"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2023-07-22 22:37:47 +02:00
|
|
|
}),
|
|
|
|
loadVersion(),
|
|
|
|
checker({
|
2023-10-01 21:08:26 +02:00
|
|
|
overlay: {
|
2023-10-27 21:51:14 +02:00
|
|
|
position: "tr"
|
2023-10-01 21:08:26 +02:00
|
|
|
},
|
2023-07-22 22:37:47 +02:00
|
|
|
typescript: true, // check typescript build errors in dev server
|
|
|
|
eslint: {
|
|
|
|
// check lint errors in dev server
|
|
|
|
lintCommand: "eslint --ext .tsx,.ts src",
|
|
|
|
dev: {
|
2023-10-27 21:51:14 +02:00
|
|
|
logLevel: ["error"]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
2023-07-22 22:37:47 +02:00
|
|
|
],
|
2023-10-01 21:08:26 +02:00
|
|
|
|
2023-07-22 22:37:47 +02:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
"@": path.resolve(__dirname, "./src"),
|
2023-10-27 21:51:14 +02:00
|
|
|
"@sozialhelden/ietf-language-tags": path.resolve(
|
|
|
|
__dirname,
|
|
|
|
"./node_modules/@sozialhelden/ietf-language-tags/dist/cjs"
|
|
|
|
)
|
|
|
|
}
|
2023-07-22 22:37:47 +02:00
|
|
|
},
|
2023-02-22 21:15:37 +01:00
|
|
|
|
2023-07-22 22:37:47 +02:00
|
|
|
test: {
|
2023-10-27 21:51:14 +02:00
|
|
|
environment: "jsdom"
|
|
|
|
}
|
2023-07-22 22:37:47 +02:00
|
|
|
};
|
2022-12-13 23:19:07 +01:00
|
|
|
});
|