This repository was archived by the owner on Aug 12, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathvite.config.ts
More file actions
74 lines (72 loc) · 2.13 KB
/
Copy pathvite.config.ts
File metadata and controls
74 lines (72 loc) · 2.13 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
73
74
/**
* Copyright (c) 2023-present, NDLA.
*
* This source code is licensed under the GPLv3 license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import { sentryVitePlugin } from "@sentry/vite-plugin";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
import { gqlPlugin } from "vite-plugin-graphql-tag";
export default defineConfig(({ isSsrBuild, mode }) => {
const componentVersion = process.env.COMPONENT_VERSION ?? "SNAPSHOT";
const isDevelopment = mode === "development";
return {
test: {
include: ["src/**/__tests__/*-test.(js|jsx|ts|tsx)"],
environment: "jsdom",
globals: true,
setupFiles: "./src/__tests__/vitest.setup.ts",
},
plugins: [
gqlPlugin({ strip: true }),
react(),
sentryVitePlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
org: process.env.SENTRY_ORG ?? "ndlano",
project: process.env.SENTRY_PROJECT ?? "ndla-frontend",
release: {
name: `ndla-frontend@${componentVersion}`,
},
url: "https://sentry.io/",
telemetry: false,
bundleSizeOptimizations: {
excludeDebugStatements: true,
excludeReplayIframe: true,
excludeReplayShadowDom: true,
excludeReplayWorker: true,
excludeTracing: true,
},
}),
],
ssr: {
noExternal: ["@apollo/client"],
},
build: {
target: "es2020",
assetsDir: "static",
outDir: "build/public",
cssCodeSplit: false,
manifest: true,
sourcemap: true,
rolldownOptions: {
input: [
"src/client.tsx",
"src/lti/index.tsx",
"src/iframe/index.tsx",
"src/iframe/embedIframeIndex.tsx",
"src/containers/ErrorPage/ErrorEntry.tsx",
],
},
},
resolve: {
dedupe: ["react-router", "i18next", "react-i18next", "@ark-ui/react", "react", "react-dom"],
conditions: ["module-sync"],
},
define: {
"globalThis.__DEV__": JSON.stringify(false),
...(isDevelopment ? {} : { __IS_SSR_BUILD__: JSON.stringify(isSsrBuild) }),
},
};
});