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'
|
2023-11-08 04:56:21 +03:00
|
|
|
import { internalIpV4Sync } from 'internal-ip'
|
|
|
|
|
|
|
|
const mobile = !!/android|ios/.exec(process.env.TAURI_ENV_PLATFORM)
|
2021-12-09 07:16:00 +03:00
|
|
|
|
|
|
|
// https://vitejs.dev/config/
|
2023-11-08 04:56:21 +03:00
|
|
|
export default defineConfig({
|
|
|
|
plugins: [Unocss(), svelte()],
|
|
|
|
build: {
|
|
|
|
rollupOptions: {
|
|
|
|
output: {
|
|
|
|
entryFileNames: `assets/[name].js`,
|
|
|
|
chunkFileNames: `assets/[name].js`,
|
|
|
|
assetFileNames: `assets/[name].[ext]`
|
2022-02-05 00:33:43 +03:00
|
|
|
}
|
2022-02-06 23:50:02 +03:00
|
|
|
}
|
2023-11-08 04:56:21 +03:00
|
|
|
},
|
|
|
|
server: {
|
|
|
|
host: mobile ? '0.0.0.0' : false,
|
|
|
|
port: 5173,
|
|
|
|
strictPort: true,
|
|
|
|
hmr: mobile
|
|
|
|
? {
|
|
|
|
protocol: 'ws',
|
|
|
|
host: internalIpV4Sync(),
|
|
|
|
port: 5183
|
|
|
|
}
|
|
|
|
: undefined,
|
|
|
|
fs: {
|
|
|
|
allow: ['.', '../../tooling/api/dist']
|
|
|
|
}
|
2022-02-05 00:33:43 +03:00
|
|
|
}
|
2021-12-09 07:16:00 +03:00
|
|
|
})
|