-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
30 lines (28 loc) · 1.36 KB
/
vite.config.ts
File metadata and controls
30 lines (28 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { defineConfig } from "vite";
import basicSsl from "@vitejs/plugin-basic-ssl";
import { autosavePlugin } from "./vite-plugin-autosave";
import { jsfxImportPlugin } from "./vite-plugin-jsfx-import";
import { phoneSensorPlugin } from "./vite-plugin-phone-sensor";
// Platform is set via the VITE_PLATFORM env var.
// browser build (default): VITE_PLATFORM unset or "browser"
// Tauri build: VITE_PLATFORM=native (set by tauri:dev / tauri:build scripts)
const platform = (process.env.VITE_PLATFORM ?? "browser") as "browser" | "native";
export default defineConfig({
base: "/patchNet/",
define: {
// Injected at compile time — tree-shakes platform-only code in production.
__PLATFORM__: JSON.stringify(platform),
},
server: {
// host: true so the dev server binds to the LAN, letting a phone scan the
// QR code and reach the sensor page without any tunnel.
host: true,
// HTTPS is required so iOS Safari will grant DeviceOrientationEvent
// permission — that API silently denies on non-secure origins (LAN IPs
// are not secure contexts; only localhost gets a free pass). The
// basic-ssl plugin generates a self-signed cert; the phone shows a
// "Not Private" warning the first time, tap through once to accept.
https: {},
},
plugins: [basicSsl(), autosavePlugin(), jsfxImportPlugin(), phoneSensorPlugin()],
});