-
Notifications
You must be signed in to change notification settings - Fork 5
/
vite.config.ts
68 lines (67 loc) · 2.01 KB
/
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
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
import { vitePlugin as remix } from "@remix-run/dev";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
import devServer from "@hono/vite-dev-server";
import esbuild from "esbuild";
export default defineConfig({
server: {
port: 3000,
https: {
key: "./server/dev/key.pem",
cert: "./server/dev/cert.pem",
},
// https://github.com/remix-run/remix/discussions/8917#discussioncomment-8640023
warmup: {
clientFiles: [
"./app/entry.client.tsx",
"./app/root.tsx",
"./app/routes/**/*",
],
},
},
// https://github.com/remix-run/remix/discussions/8917#discussioncomment-8640023
optimizeDeps: {
include: ["./app/routes/**/*"],
},
// Hello 👋 Prisma users, uncomment that. Thanks @AlemTuzlak
// resolve: {
// alias: {
// ".prisma/client/index-browser":
// "./node_modules/.prisma/client/index-browser.js",
// },
// },
plugins: [
devServer({
injectClientScript: false,
entry: "server/index.ts", // The file path of your server.
exclude: [/^\/(app)\/.+/, /^\/@.+$/, /^\/node_modules\/.*/],
}),
tsconfigPaths(),
remix({
serverBuildFile: "remix.js",
buildEnd: async () => {
await esbuild
.build({
alias: { "~": "./app" },
// The final file name
outfile: "build/server/index.js",
// Our server entry point
entryPoints: ["server/index.ts"],
// Dependencies that should not be bundled
// We import the remix build from "../build/server/remix.js", so no need to bundle it again
external: ["./build/server/*"],
platform: "node",
format: "esm",
// Don't include node_modules in the bundle
packages: "external",
bundle: true,
logLevel: "info",
})
.catch((error: unknown) => {
console.error(error);
process.exit(1);
});
},
}),
],
});