-
-
Notifications
You must be signed in to change notification settings - Fork 149
/
Copy pathsvelte.config.js
42 lines (34 loc) · 1.3 KB
/
svelte.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { vitePreprocess } from "@sveltejs/kit/vite";
import adapter from "@sveltejs/adapter-node";
const basePath = !!process.env.KENER_BASE_PATH ? process.env.KENER_BASE_PATH : "";
const VITE_BUILD_ENV = process.env.VITE_BUILD_ENV || "development"; // Default to "development"
const isProduction = VITE_BUILD_ENV === "production";
/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
adapter: adapter(),
paths: {
base: basePath
}
},
preprocess: [vitePreprocess({})],
compilerOptions: {
dev: !isProduction, // Disable dev mode in production
enableSourcemap: !isProduction // Disable sourcemaps in production
},
onwarn: (warning, handler) => {
// Suppress specific warnings in production
const ignoredWarnings = [
"a11y-", // Accessibility warnings
"unused-export-let", // Suppresses "unused export property" warnings
"empty-chunk", // Suppresses empty chunk warnings
"module-unused-import", // Suppresses unused imports like "default" from auto-animate
"conflicting-svelte-resolve" // Suppresses conflicting resolve warnings
];
if (isProduction && ignoredWarnings.some((w) => warning.code && warning.code.startsWith(w))) {
return; // Ignore these warnings in production builds
}
handler(warning); // Otherwise, show the warning
}
};
export default config;