-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvite.config.ts
48 lines (44 loc) · 1.31 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
import { defineConfig as defineViteConfig, mergeConfig } from "vite";
import { defineConfig as defineVitestConfig, configDefaults } from "vitest/config";
import react from "@vitejs/plugin-react";
import path from "path";
const viteConfig = defineViteConfig({
plugins: [react(), {
name: 'html-transform',
transformIndexHtml(html) {
if (process.env.NODE_ENV !== 'development') return html;
if (process.env.VITE_BITCR_DEV_INCLUDE_CROWDIN_IN_CONTEXT_TOOLING !== 'true') return html;
return html.replace(
"</body>",
`
<script type="text/javascript">
var _jipt = [];
_jipt.push(['project', 'bitcredit']);
</script>
<script type="text/javascript" src="//cdn.crowdin.com/jipt/jipt.js"></script>
</body>
`,
)
},
}],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
assetsInclude: ["**/*.woff2"],
});
const vitestConfig = defineVitestConfig({
test: {
environment: "jsdom",
include: ["**/*.test.{ts,tsx}"],
setupFiles: ['./vitest-setup.ts'],
coverage: {
provider: "v8",
reporter: ["text", "json", "lcov"],
reportsDirectory: "./coverage",
},
exclude: [...configDefaults.exclude],
},
});
export default mergeConfig(viteConfig, vitestConfig);