Piped/vite.config.js

79 lines
2.7 KiB
JavaScript
Raw Normal View History

2021-12-28 14:39:20 +00:00
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
2022-08-17 13:34:57 +00:00
import Unocss from "unocss/vite";
import legacy from "@vitejs/plugin-legacy";
2023-06-17 05:05:44 +00:00
import VueI18nPlugin from "@intlify/unplugin-vue-i18n/vite";
2021-12-28 14:59:58 +00:00
import { VitePWA } from "vite-plugin-pwa";
2021-12-28 14:39:20 +00:00
import path from "path";
import eslintPlugin from "vite-plugin-eslint";
2021-12-28 14:39:20 +00:00
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
2022-08-17 13:34:57 +00:00
Unocss(),
2023-06-17 05:05:44 +00:00
VueI18nPlugin({
2021-12-28 14:39:20 +00:00
include: path.resolve(__dirname, "./src/locales/**"),
}),
legacy({
targets: ["defaults", "not IE 11"],
}),
2021-12-28 19:39:02 +00:00
VitePWA({
registerType: "autoUpdate",
workbox: {
globPatterns: ["**/*.{js,css,html,ico,svg,png}", "manifest.webmanifest"],
2023-01-26 00:21:38 +00:00
globIgnores: ["**/*-legacy-*.js"],
2022-01-13 06:30:23 +00:00
runtimeCaching: [
{
urlPattern: /https:\/\/[a-zA-Z./0-9_]*\.(?:otf|ttf)/i,
handler: "CacheFirst",
options: {
cacheName: "fonts-cache",
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 * 365, // <== 365 days
},
cacheableResponse: {
statuses: [0, 200],
},
},
},
],
2021-12-28 19:39:02 +00:00
},
manifest: {
name: "Piped",
short_name: "Piped",
background_color: "#000000",
theme_color: "#fa4b4b",
icons: [
{ src: "./img/icons/android-chrome-192x192.png", sizes: "192x192", type: "image/png" },
{ src: "./img/icons/android-chrome-512x512.png", sizes: "512x512", type: "image/png" },
{
src: "./img/icons/android-chrome-maskable-192x192.png",
sizes: "192x192",
type: "image/png",
purpose: "maskable",
},
{
src: "./img/icons/android-chrome-maskable-512x512.png",
sizes: "512x512",
type: "image/png",
purpose: "maskable",
},
],
},
}),
eslintPlugin(),
2021-12-28 14:39:20 +00:00
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
stream: "stream-browserify",
2021-12-28 14:39:20 +00:00
},
},
2021-12-28 18:54:28 +00:00
build: {
sourcemap: true,
2023-07-06 12:08:09 +00:00
cssMinify: "lightningcss",
2021-12-28 18:54:28 +00:00
},
2021-12-28 14:39:20 +00:00
});