-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.js
53 lines (49 loc) · 1.19 KB
/
vite.config.js
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
import { join, resolve } from 'path';
import react from "@vitejs/plugin-react";
import { defineConfig } from 'vite';
/// <reference types="vitest" />
// https://vitejs.dev/config/
/** @type {import('vite').UserConfig} */
export default defineConfig({
root: 'frontend',
plugins: [react()],
test: {
include: ['**/__tests__/*.test.{ts,tsx}']
},
resolve: {
alias: [
{
find: '@/',
replacement: join(__dirname, 'frontend/'),
},
],
},
server: {
port: 5173,
strictPort: true,
hmr: {
port: 5173,
},
},
build: {
outDir: resolve(__dirname, 'web'),
emptyOutDir: true,
rollupOptions: {
input: {
'': resolve(__dirname, 'frontend/index.html'),
},
output: {
entryFileNames: `assets/[name]/bundle.js`,
assetFileNames: (assetInfo) => {
const { name } = assetInfo
if (name === '.css') {
// FIXME: Hotfix for a bug that somehow the extension disappears from the output of smarthr-ui/smarthr-ui.css.
return `assets/[hash][extname][name]`
} else {
return `assets/[name][hash][extname]`
}
},
},
},
},
});