movie-web/vite.config.ts

104 lines
2.0 KiB
TypeScript
Raw Normal View History

2023-02-22 21:15:37 +01:00
import { defineConfig } from "vitest/config";
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";
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 21:41:15 +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 }) => {
return {
plugins:[
handlebars({
vars: {
appdomain: loadEnv(mode, process.cwd()).VITE_APP_DOMAIN,
},
}),
react({
babel: {
presets: [
"@babel/preset-typescript",
[
"@babel/preset-env",
{
modules: false,
useBuiltIns: "entry",
corejs: {
version: "3.29",
},
},
],
],
},
}),
VitePWA({
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",
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({
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"],
},
},
}),
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
2023-02-22 21:15:37 +01:00
2023-07-22 21:41:15 +02:00
test: {
environment: "jsdom",
},
};
2022-12-13 23:19:07 +01:00
});