2025-11-22 23:39:25 +08:00
|
|
|
import { defineConfig, PluginOption } from "vite"
|
|
|
|
|
import { solidStart } from "@solidjs/start/config"
|
|
|
|
|
import { nitro } from "nitro/vite"
|
|
|
|
|
import tailwindcss from "@tailwindcss/vite"
|
|
|
|
|
|
2025-11-23 03:38:56 +08:00
|
|
|
const nitroConfig: any = (() => {
|
2025-11-22 23:39:25 +08:00
|
|
|
const target = process.env.OPENCODE_DEPLOYMENT_TARGET
|
|
|
|
|
if (target === "cloudflare") {
|
|
|
|
|
return {
|
|
|
|
|
compatibilityDate: "2024-09-19",
|
2026-05-26 06:34:04 +08:00
|
|
|
preset: "cloudflare-module",
|
2025-11-22 23:39:25 +08:00
|
|
|
cloudflare: {
|
|
|
|
|
nodeCompat: true,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return {}
|
|
|
|
|
})()
|
|
|
|
|
|
|
|
|
|
export default defineConfig({
|
2025-12-11 12:18:53 +08:00
|
|
|
plugins: [
|
|
|
|
|
tailwindcss(),
|
|
|
|
|
solidStart() as PluginOption,
|
|
|
|
|
nitro({
|
|
|
|
|
...nitroConfig,
|
|
|
|
|
baseURL: process.env.OPENCODE_BASE_URL,
|
|
|
|
|
}),
|
|
|
|
|
],
|
2025-11-22 23:39:25 +08:00
|
|
|
server: {
|
|
|
|
|
host: "0.0.0.0",
|
|
|
|
|
allowedHosts: true,
|
2026-05-28 19:50:14 +08:00
|
|
|
port: 3002,
|
2025-11-22 23:39:25 +08:00
|
|
|
},
|
2025-12-03 03:08:59 +08:00
|
|
|
worker: {
|
|
|
|
|
format: "es",
|
|
|
|
|
},
|
2025-11-22 23:39:25 +08:00
|
|
|
})
|