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