-
Notifications
You must be signed in to change notification settings - Fork 380
Expand file tree
/
Copy pathvite.config.js
More file actions
56 lines (52 loc) · 1.74 KB
/
vite.config.js
File metadata and controls
56 lines (52 loc) · 1.74 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
import { defineConfig } from 'vite'
import viteReact from '@vitejs/plugin-react'
import { TanStackRouterVite } from '@tanstack/router-plugin/vite'
import { resolve } from 'node:path'
import tailwindcss from '@tailwindcss/vite'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
TanStackRouterVite({ autoCodeSplitting: false }),
viteReact(),
tailwindcss(),
],
test: {
globals: true,
environment: 'jsdom',
},
// This is to ensure we can import the bus module from the bus folder and have nice import paths
resolve: {
alias: {
'@': resolve(__dirname, './src'),
'@bus': resolve(__dirname, '../bus/src'),
},
},
// This is to ensure that the assets are in the assets folder are all named assets/[name].[extension] rather
// than having a hash.
build: {
// Everything below is pure Rollup syntax
rollupOptions: {
output: {
// ── JavaScript ──────────────────────────────────────
entryFileNames: 'assets/[name].js', // main-entry
chunkFileNames: 'assets/[name].js', // code-splits
// ── CSS & other assets ─────────────────────────────
assetFileNames: ({ name }) => {
// name = original file name with extension
const ext = name?.substring(name.lastIndexOf('.'))
return `assets/[name]${ext}` // e.g. style.css
},
},
},
},
// This ensures that the API calls to the server are proxied to the server.
server: {
proxy: {
'/api': {
target: 'http://localhost:5174',
changeOrigin: true,
secure: false,
},
},
},
})