-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathvite.config.ts
44 lines (40 loc) · 1.02 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
/// <reference types="vitest" />
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { readFileSync } from 'fs'
import path from 'path'
/**
* used to set the relative path from which we expect to serve the admin's
* static bundle on the server:
* GH Pages: /kinto-admin/
* Kinto plugin: /v1/admin/
*/
const ASSET_PATH = process.env.ASSET_PATH || "/";
const KINTO_ADMIN_VERSION = readFileSync('./public/VERSION').toString();
// https://vitejs.dev/config/
export default defineConfig({
server: {
port: 3000,
},
envPrefix: 'KINTO_ADMIN',
plugins: [react()],
base: ASSET_PATH,
define: {
KINTO_ADMIN_VERSION: JSON.stringify(KINTO_ADMIN_VERSION)
},
resolve: {
alias: {
'@src': path.resolve(__dirname, './src'),
'@test': path.resolve(__dirname, './test')
}
},
build: {
outDir: "build"
},
test: {
globals: true,
environment: "jsdom",
include: ["**/*_{test,spec}.?(c|m)[jt]s?(x)"],
setupFiles: ["test/setupTests.ts"]
}
})