ff-admin/vite.config.ts

61 lines
1.7 KiB
TypeScript
Raw Permalink Normal View History

2025-01-03 15:27:39 +00:00
import { fileURLToPath, URL } from "node:url";
2024-08-22 09:48:04 +00:00
2025-01-03 15:27:39 +00:00
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueDevTools from "vite-plugin-vue-devtools";
import Markdown from "unplugin-vue-markdown/vite";
import hljs from "highlight.js";
2024-08-22 09:48:04 +00:00
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
2025-01-03 15:27:39 +00:00
vue({
include: [/\.vue$/, /\.md$/],
}),
2024-08-22 09:48:04 +00:00
vueDevTools(),
2025-01-03 15:27:39 +00:00
Markdown({
// Optionen für Markdown-It (optional)
markdownItOptions: {
html: true,
linkify: true,
typographer: true,
},
markdownItSetup(md) {
// Syntax-Highlighting aktivieren
md.set({
highlight: (str, lang) => {
if (lang && hljs.getLanguage(lang)) {
try {
return `<pre class="hljs" style="padding:8px"><code>${hljs.highlight(str, { language: lang }).value}</code></pre>`;
} catch (__) {}
}
return `<pre class="hljs" style="padding:8px"><code>${md.utils.escapeHtml(str)}</code></pre>`;
},
});
},
}),
2024-08-22 09:48:04 +00:00
],
resolve: {
alias: {
2025-01-03 15:27:39 +00:00
"@": fileURLToPath(new URL("./src", import.meta.url)),
$: fileURLToPath(new URL("./docs", import.meta.url)),
},
},
2025-01-06 14:04:47 +00:00
build: {
rollupOptions: {
output: {
// Define the main output bundle (e.g., for your application)
entryFileNames: "[name]-[hash].js",
// Define the directory where the main bundle should be output
dir: "dist",
// Create a separate output bundle for your specific file
manualChunks(id) {
if (id.endsWith("src/config.ts")) {
return "config"; // This will create a separate bundle for config-[hash].js
}
},
},
},
},
2025-01-03 15:27:39 +00:00
});