forked from gothinkster/realworld-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 3
/
vite.config.ts
43 lines (39 loc) · 1018 Bytes
/
vite.config.ts
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
31
32
33
34
35
36
37
38
39
40
41
42
43
import { defineConfig } from "vite";
import rakkas from "rakkasjs/vite-plugin";
import path from "path";
import tsconfigPaths from "vite-tsconfig-paths";
import { bundleForDeno } from "./bundle-for-deno";
const target = process.env.RAKKAS_TARGET || "node";
export default defineConfig({
plugins: [
tsconfigPaths(),
rakkas({
adapter:
target === "deno"
? {
// This special bundler is needed
// for Deno Deploy compatibility
// Rakkas will soon support this
// out of the box.
name: "Deno",
bundle: bundleForDeno,
}
: (target as any),
}),
// Stub for serverless
target !== "node" && {
enforce: "pre",
name: "rakkasjs-realowrld-auth-stub",
resolveId(id) {
if (id === path.resolve("src/lib/auth-service")) {
return path.resolve("src/lib/auth-service-stub.ts");
}
return undefined;
},
},
],
optimizeDeps: {
include: ["cookie", "http-status-codes", "react-markdown"],
exclude: ["@hattip/response"],
},
});