2022-02-28 01:29:58 +08:00
|
|
|
import VueI18n from "@intlify/vite-plugin-vue-i18n";
|
2022-02-13 02:24:05 +08:00
|
|
|
import Vue from "@vitejs/plugin-vue";
|
2022-02-28 01:29:58 +08:00
|
|
|
import path from "node:path";
|
2022-02-13 02:24:05 +08:00
|
|
|
import IconsResolver from "unplugin-icons/resolver";
|
2022-02-28 01:29:58 +08:00
|
|
|
import Icons from "unplugin-icons/vite";
|
|
|
|
import Components from "unplugin-vue-components/vite";
|
|
|
|
import { defineConfig } from "vite";
|
|
|
|
import EslintPlugin from "vite-plugin-eslint";
|
|
|
|
import Pages from "vite-plugin-pages";
|
2022-02-13 02:24:05 +08:00
|
|
|
import { VitePWA } from "vite-plugin-pwa";
|
2022-02-28 01:29:58 +08:00
|
|
|
import Layouts from "vite-plugin-vue-layouts";
|
|
|
|
import WindiCSS from "vite-plugin-windicss";
|
2022-02-13 02:24:05 +08:00
|
|
|
import viteSSR from "vite-ssr/plugin";
|
2022-06-29 02:49:11 +08:00
|
|
|
import prettier from "./src/lib/plugins/prettier";
|
2022-03-26 03:40:37 +08:00
|
|
|
// seriously? just shit up, lol
|
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
|
|
// @ts-ignore
|
|
|
|
import { default as proxyConfig } from "./proxy.config";
|
2022-02-13 02:24:05 +08:00
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
"~/": `${path.resolve(__dirname, "src")}/`,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
viteSSR(),
|
|
|
|
|
|
|
|
Vue({
|
|
|
|
include: [/\.vue$/, /\.md$/],
|
|
|
|
}),
|
|
|
|
|
|
|
|
// https://github.com/hannoeru/vite-plugin-pages
|
|
|
|
Pages({
|
|
|
|
extensions: ["vue", "md"],
|
|
|
|
}),
|
|
|
|
|
|
|
|
// https://github.com/JohnCampionJr/vite-plugin-vue-layouts
|
|
|
|
Layouts(),
|
|
|
|
|
2022-02-28 01:29:58 +08:00
|
|
|
// https://github.com/antfu/unplugin-vue-components
|
2022-02-13 02:24:05 +08:00
|
|
|
Components({
|
2022-02-27 22:00:14 +08:00
|
|
|
// we don't want to import components, just icons
|
|
|
|
dirs: ["none"],
|
2022-02-13 02:24:05 +08:00
|
|
|
// auto import icons
|
|
|
|
resolvers: [
|
|
|
|
// https://github.com/antfu/vite-plugin-icons
|
|
|
|
IconsResolver({
|
2022-02-15 22:17:08 +08:00
|
|
|
componentPrefix: "icon",
|
2022-02-28 01:29:58 +08:00
|
|
|
enabledCollections: ["mdi"],
|
2022-02-13 02:24:05 +08:00
|
|
|
}),
|
|
|
|
],
|
2022-02-28 01:29:58 +08:00
|
|
|
dts: "src/types/generated/icons.d.ts",
|
2022-02-13 02:24:05 +08:00
|
|
|
}),
|
|
|
|
|
2022-02-28 01:29:58 +08:00
|
|
|
// https://github.com/antfu/unplugin-icons
|
2022-02-13 02:24:05 +08:00
|
|
|
Icons({
|
2022-02-13 18:56:14 +08:00
|
|
|
autoInstall: true,
|
2022-02-13 02:24:05 +08:00
|
|
|
}),
|
|
|
|
|
2022-02-28 01:29:58 +08:00
|
|
|
// https://github.com/windicss/vite-plugin-windicss
|
2022-02-13 02:24:05 +08:00
|
|
|
WindiCSS({
|
|
|
|
safelist: "prose prose-sm m-auto",
|
|
|
|
}),
|
|
|
|
|
|
|
|
// https://github.com/antfu/vite-plugin-pwa
|
|
|
|
VitePWA({
|
2022-02-13 18:56:14 +08:00
|
|
|
includeAssets: ["favicon/*"],
|
2022-03-13 02:13:50 +08:00
|
|
|
strategies: "injectManifest",
|
|
|
|
disable: true,
|
2022-02-13 02:24:05 +08:00
|
|
|
manifest: {
|
|
|
|
name: "Hangar | PaperMC",
|
|
|
|
short_name: "Hangar",
|
|
|
|
description: "Plugin repository for Paper plugins and more!",
|
|
|
|
theme_color: "#ffffff",
|
|
|
|
icons: [
|
|
|
|
{
|
2022-02-13 18:56:14 +08:00
|
|
|
src: "/favicon/android-chrome-192x192.png",
|
2022-02-13 02:24:05 +08:00
|
|
|
sizes: "192x192",
|
|
|
|
type: "image/png",
|
|
|
|
},
|
|
|
|
{
|
2022-02-13 18:56:14 +08:00
|
|
|
src: "/favicon/android-chrome-512x512.png",
|
2022-02-13 02:24:05 +08:00
|
|
|
sizes: "512x512",
|
|
|
|
type: "image/png",
|
|
|
|
},
|
|
|
|
{
|
2022-02-13 18:56:14 +08:00
|
|
|
src: "/favicon/android-chrome-512x512.png",
|
2022-02-13 02:24:05 +08:00
|
|
|
sizes: "512x512",
|
|
|
|
type: "image/png",
|
|
|
|
purpose: "any maskable",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
|
2022-02-28 01:29:58 +08:00
|
|
|
// https://github.com/intlify/bundle-tools/tree/main/packages/vite-plugin-vue-i18n
|
2022-02-13 02:24:05 +08:00
|
|
|
VueI18n({
|
2022-07-05 00:38:32 +08:00
|
|
|
runtimeOnly: false,
|
|
|
|
include: [path.resolve(__dirname, "src/locales/*.json")],
|
2022-02-13 02:24:05 +08:00
|
|
|
}),
|
|
|
|
|
|
|
|
EslintPlugin({
|
2022-02-13 18:56:14 +08:00
|
|
|
fix: true,
|
2022-02-13 02:24:05 +08:00
|
|
|
}),
|
2022-02-28 01:29:58 +08:00
|
|
|
prettier(),
|
2022-02-13 02:24:05 +08:00
|
|
|
],
|
|
|
|
|
|
|
|
optimizeDeps: {
|
2022-07-26 16:01:13 +08:00
|
|
|
include: ["vue", "vue-router", "@vueuse/core", "@vueuse/head", "swagger-ui-dist"],
|
2022-02-13 18:56:14 +08:00
|
|
|
exclude: ["vue-demi"],
|
2022-02-13 02:24:05 +08:00
|
|
|
},
|
|
|
|
|
2022-03-06 02:27:52 +08:00
|
|
|
envDir: ".env",
|
|
|
|
envPrefix: "HANGAR",
|
|
|
|
|
2022-02-13 02:24:05 +08:00
|
|
|
server: {
|
2022-03-26 03:40:37 +08:00
|
|
|
proxy: proxyConfig.default,
|
2022-02-13 18:56:14 +08:00
|
|
|
},
|
2022-03-13 02:13:50 +08:00
|
|
|
|
|
|
|
// ssr options aren't part of release types for vite cause its still marked as experimental
|
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
|
|
// @ts-ignore
|
|
|
|
ssr: {
|
|
|
|
noExternal: ["lodash-es"],
|
|
|
|
},
|
2022-02-13 02:24:05 +08:00
|
|
|
});
|