-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
51 lines (48 loc) · 1.37 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
/// <reference types="vitest" />
import devServer, { defaultOptions } from "@hono/vite-dev-server";
import { vitePlugin as remix } from "@remix-run/dev";
import { flatRoutes } from "remix-flat-routes";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
const isStorybook = process.argv[1]?.includes("storybook");
export default defineConfig({
server: {
port: 3000,
},
plugins: [
!isStorybook &&
process.env.NODE_ENV !== "test" &&
remix({
serverBuildFile: "remix.js",
ignoredRouteFiles: ["**/*"],
routes: async (defineRoutes) => {
const routes = flatRoutes("routes", defineRoutes, {
ignoredRouteFiles: [
"**/*.test.tsx",
"**/*.spec.tsx",
"**/*.story.tsx",
"**/*.stories.tsx",
],
});
return routes;
},
}),
tsconfigPaths(),
!isStorybook &&
devServer({
injectClientScript: false,
entry: "./server/index.ts",
exclude: [/^\/(app)\/.+/, ...defaultOptions.exclude],
}),
],
test: {
include: ["./app/**/*.{test,spec}.{ts,tsx}"],
environment: "jsdom",
setupFiles: ["./tests/setup/setup-test-env.ts"],
globalSetup: ["./tests/setup/global-setup.ts"],
coverage: {
include: ["app/**/*.{ts,tsx}"],
all: true,
},
},
});