svelte.config.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import adapter from '@sveltejs/adapter-static';
  2. import * as child_process from 'node:child_process';
  3. import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
  4. /** @type {import('@sveltejs/kit').Config} */
  5. const config = {
  6. // Consult https://kit.svelte.dev/docs/integrations#preprocessors
  7. // for more information about preprocessors
  8. preprocess: vitePreprocess(),
  9. kit: {
  10. // adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
  11. // If your environment is not supported or you settled on a specific environment, switch out the adapter.
  12. // See https://kit.svelte.dev/docs/adapters for more information about adapters.
  13. adapter: adapter({
  14. pages: 'build',
  15. assets: 'build',
  16. fallback: 'index.html'
  17. }),
  18. // poll for new version name every 60 seconds (to trigger reload mechanic in +layout.svelte)
  19. version: {
  20. name: child_process.execSync('git rev-parse HEAD').toString().trim(),
  21. pollInterval: 60000
  22. }
  23. },
  24. vitePlugin: {
  25. // inspector: {
  26. // toggleKeyCombo: 'meta-shift', // Key combination to open the inspector
  27. // holdMode: false, // Enable or disable hold mode
  28. // showToggleButton: 'always', // Show toggle button ('always', 'active', 'never')
  29. // toggleButtonPos: 'bottom-right' // Position of the toggle button
  30. // }
  31. },
  32. onwarn: (warning, handler) => {
  33. const { code } = warning;
  34. if (code === 'css-unused-selector') return;
  35. handler(warning);
  36. }
  37. };
  38. export default config;