forked from Shelf-nu/shelf.nu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
72 lines (69 loc) · 1.81 KB
/
vite.config.ts
File metadata and controls
72 lines (69 loc) · 1.81 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { reactRouter } from "@react-router/dev/vite";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
import { reactRouterHonoServer } from "react-router-hono-server/dev";
import { cjsInterop } from "vite-plugin-cjs-interop";
import { init } from "@paralleldrive/cuid2";
const createHash = init({
length: 8,
});
const buildHash = process.env.BUILD_HASH || createHash();
export default defineConfig({
server: {
port: 3000,
https: {
key: "./.cert/key.pem",
cert: "./.cert/cert.pem",
},
warmup: {
clientFiles: [
"./app/entry.client.tsx",
"./app/root.tsx",
"./app/routes/**/*.tsx",
"./app/routes/**/*.ts",
"!./app/routes/**/*.test.server.ts",
],
},
},
optimizeDeps: {
include: ["./app/routes/**/*.tsx", "./app/routes/**/*.ts"],
},
build: {
target: "ES2022",
assetsDir: `file-assets`,
rollupOptions: {
output: {
entryFileNames: `file-assets/${buildHash}/[name]-[hash].js`,
chunkFileNames() {
return `file-assets/${buildHash}/[name]-[hash].js`;
},
assetFileNames() {
return `file-assets/${buildHash}/[name][extname]`;
},
},
},
},
resolve: {
alias: {
".prisma/client/index-browser":
"./node_modules/.prisma/client/index-browser.js",
// Use lottie_light version to avoid eval warnings
"lottie-web": "lottie-web/build/player/lottie_light.js",
},
},
plugins: [
cjsInterop({
// List of CJS dependencies that require interop
dependencies: [
"react-microsoft-clarity",
"@markdoc/markdoc",
"react-to-print",
],
}),
reactRouterHonoServer({
serverEntryPoint: "./server/index.ts",
}),
reactRouter(),
tsconfigPaths(),
],
});