2024-10-03 23:11:10 +08:00
|
|
|
import { join } from "node:path"
|
2024-09-26 11:30:21 +08:00
|
|
|
import { defineConfig } from "vite"
|
|
|
|
import react from "@vitejs/plugin-react-swc"
|
|
|
|
import { TanStackRouterVite } from "@tanstack/router-plugin/vite"
|
2024-09-26 19:16:42 +08:00
|
|
|
import unocss from "unocss/vite"
|
2024-10-31 01:12:44 +08:00
|
|
|
import unimport from "unimport/unplugin"
|
2024-10-30 15:06:21 +08:00
|
|
|
import nitro from "./nitro.config"
|
2024-10-03 23:11:10 +08:00
|
|
|
import { projectDir } from "./shared/dir"
|
2024-10-30 15:06:21 +08:00
|
|
|
import pwa from "./pwa.config"
|
2024-10-03 23:11:10 +08:00
|
|
|
|
2024-11-10 23:26:02 +08:00
|
|
|
// dotenv.config({
|
|
|
|
// path: join(projectDir, ".env.server"),
|
|
|
|
// })
|
2024-10-14 00:02:58 +08:00
|
|
|
|
2024-09-26 11:30:21 +08:00
|
|
|
export default defineConfig({
|
2024-10-30 15:06:21 +08:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
"~": join(projectDir, "src"),
|
|
|
|
"@shared": join(projectDir, "shared"),
|
|
|
|
},
|
|
|
|
},
|
2024-09-26 11:30:21 +08:00
|
|
|
plugins: [
|
|
|
|
TanStackRouterVite({
|
2024-10-31 01:12:44 +08:00
|
|
|
// error with auto import and vite-plugin-pwa
|
2024-10-30 15:06:21 +08:00
|
|
|
// autoCodeSplitting: true,
|
|
|
|
}),
|
2024-10-31 01:12:44 +08:00
|
|
|
unimport.vite({
|
2024-10-30 15:06:21 +08:00
|
|
|
dirs: ["src/hooks", "shared", "src/utils", "src/atoms"],
|
2024-10-31 01:12:44 +08:00
|
|
|
presets: ["react", {
|
|
|
|
from: "jotai",
|
|
|
|
imports: ["atom", "useAtom", "useAtomValue", "useSetAtom"],
|
2024-10-30 15:06:21 +08:00
|
|
|
}],
|
2024-10-31 01:12:44 +08:00
|
|
|
imports: [
|
|
|
|
{ from: "clsx", name: "default", as: "$" },
|
|
|
|
{ from: "jotai/utils", name: "atomWithStorage" },
|
|
|
|
],
|
|
|
|
dts: "imports.app.d.ts",
|
2024-09-26 11:30:21 +08:00
|
|
|
}),
|
2024-09-26 19:16:42 +08:00
|
|
|
unocss(),
|
2024-09-26 11:30:21 +08:00
|
|
|
react(),
|
2024-10-30 15:06:21 +08:00
|
|
|
pwa(),
|
|
|
|
nitro(),
|
2024-09-26 11:30:21 +08:00
|
|
|
],
|
|
|
|
})
|