Files
kener/svelte.config.js
T
Kyle Affolder 559f5bd257 Update: Suppress warnings in production build
When building for production, various warnings are output which slows down production build.

The following changes were made:
- Suppress unused export properties (unused-export-let).
- Suppress conflicting Svelte resolve warnings (conflicting-svelte-resolve).
- Suppress empty chunk warnings (empty-chunk).
- Suppress unused module imports (module-unused-import).
- Keep other important warnings visible, so we’re still aware of potential issues.

Now, production build should be cleaner and faster! 🚀
2025-02-04 16:03:10 -05:00

43 lines
1.3 KiB
JavaScript

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;