vite.config.js 970 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright 2019-2023 Tauri Programme within The Commons Conservancy
  2. // SPDX-License-Identifier: Apache-2.0
  3. // SPDX-License-Identifier: MIT
  4. import { defineConfig } from 'vite'
  5. import Unocss from 'unocss/vite'
  6. import { svelte } from '@sveltejs/vite-plugin-svelte'
  7. import { internalIpV4Sync } from 'internal-ip'
  8. const mobile = !!/android|ios/.exec(process.env.TAURI_ENV_PLATFORM)
  9. // https://vitejs.dev/config/
  10. export default defineConfig({
  11. plugins: [Unocss(), svelte()],
  12. build: {
  13. rollupOptions: {
  14. output: {
  15. entryFileNames: `assets/[name].js`,
  16. chunkFileNames: `assets/[name].js`,
  17. assetFileNames: `assets/[name].[ext]`
  18. }
  19. }
  20. },
  21. server: {
  22. host: mobile ? '0.0.0.0' : false,
  23. port: 5173,
  24. strictPort: true,
  25. hmr: mobile
  26. ? {
  27. protocol: 'ws',
  28. host: internalIpV4Sync(),
  29. port: 5183
  30. }
  31. : undefined,
  32. fs: {
  33. allow: ['.', '../../tooling/api/dist']
  34. }
  35. }
  36. })