2023-02-19 16:17:49 +03:00
|
|
|
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
2021-12-09 07:16:00 +03:00
|
|
|
import { defineConfig } from 'vite'
|
2022-07-04 04:15:23 +03:00
|
|
|
import Unocss from 'unocss/vite'
|
2021-12-09 07:16:00 +03:00
|
|
|
import { svelte } from '@sveltejs/vite-plugin-svelte'
|
2022-08-20 22:53:07 +03:00
|
|
|
import { internalIpV4 } from 'internal-ip'
|
2021-12-09 07:16:00 +03:00
|
|
|
|
|
|
|
// https://vitejs.dev/config/
|
2022-08-20 22:53:07 +03:00
|
|
|
export default defineConfig(async ({ command, mode }) => {
|
2023-01-24 00:26:13 +03:00
|
|
|
const host = process.env.TAURI_PLATFORM === 'android' || process.env.TAURI_PLATFORM === 'ios' ? (await internalIpV4()) : 'localhost'
|
2022-08-20 22:53:07 +03:00
|
|
|
return {
|
|
|
|
plugins: [Unocss(), svelte()],
|
|
|
|
build: {
|
|
|
|
rollupOptions: {
|
|
|
|
output: {
|
|
|
|
entryFileNames: `assets/[name].js`,
|
|
|
|
chunkFileNames: `assets/[name].js`,
|
|
|
|
assetFileNames: `assets/[name].[ext]`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
server: {
|
2022-12-03 16:20:04 +03:00
|
|
|
host: '0.0.0.0',
|
2022-08-23 18:40:02 +03:00
|
|
|
port: 5173,
|
|
|
|
strictPort: true,
|
2022-08-20 22:53:07 +03:00
|
|
|
hmr: {
|
2022-08-25 06:19:47 +03:00
|
|
|
protocol: 'ws',
|
2022-08-20 22:53:07 +03:00
|
|
|
host,
|
|
|
|
port: 5183
|
|
|
|
},
|
|
|
|
fs: {
|
|
|
|
allow: ['.', '../../tooling/api/dist']
|
2022-02-05 00:33:43 +03:00
|
|
|
}
|
2022-02-06 23:50:02 +03:00
|
|
|
}
|
2022-02-05 00:33:43 +03:00
|
|
|
}
|
2021-12-09 07:16:00 +03:00
|
|
|
})
|