2021-12-12 11:56:26 +00:00
|
|
|
import resolve from 'path';
|
2021-12-09 11:53:54 +00:00
|
|
|
import { defineConfig } from 'vite'
|
|
|
|
import { svelte } from '@sveltejs/vite-plugin-svelte'
|
|
|
|
|
|
|
|
// https://vitejs.dev/config/
|
|
|
|
export default defineConfig({
|
|
|
|
plugins: [svelte()],
|
2021-12-12 11:05:24 +00:00
|
|
|
optimizeDeps: { exclude: ["svelte-navigator"] },
|
2021-12-12 11:56:26 +00:00
|
|
|
build: {
|
2022-05-17 03:14:06 +00:00
|
|
|
outDir: "dist",
|
|
|
|
sourcemap: true,
|
2022-12-05 09:53:05 +00:00
|
|
|
rollupOptions: {
|
|
|
|
manualChunks(filename) {
|
|
|
|
filename = filename.split("node_modules");
|
|
|
|
if (filename.length < 2) return 'index';
|
|
|
|
else filename = filename[1];
|
|
|
|
|
2023-03-13 16:13:09 +00:00
|
|
|
if (filename.startsWith("/highlight.js/es/languages/")) {
|
|
|
|
const lang = filename.split("/").pop().split(".").shift();
|
|
|
|
|
|
|
|
return `vendor_hljs-${lang}`;
|
|
|
|
}
|
2022-12-05 09:53:05 +00:00
|
|
|
|
|
|
|
return 'vendor-1';
|
|
|
|
// return `vendor-${filename.charCodeAt(1) % 2}`;
|
|
|
|
}
|
2023-03-13 16:13:09 +00:00
|
|
|
}
|
2021-12-12 11:05:24 +00:00
|
|
|
}
|
2021-12-09 11:53:54 +00:00
|
|
|
})
|