Skip to content

Commit e98e395

Browse files
authored
Refactor Vite config to use concise syntax
Avoids too many unnecessary whitespace changes in this PR
1 parent 1847fa6 commit e98e395

File tree

1 file changed

+34
-38
lines changed

1 file changed

+34
-38
lines changed

frontend/vite.config.ts

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,39 @@ import tsconfigPaths from 'vite-tsconfig-paths'
55
import { APP_BASEPATH } from './app/lib/constants.js'
66
import path from 'path'
77

8-
export default defineConfig(({ mode, isSsrBuild }) => {
9-
const isProduction = mode === 'production'
10-
const alias: Record<string, string> = {
11-
'@/components': path.resolve(
12-
__dirname,
13-
'./app/components/redesign/components'
14-
),
15-
'@/typography': path.resolve(
16-
__dirname,
17-
'./app/components/redesign/Typography.tsx'
18-
),
19-
'@/assets': path.resolve(__dirname, './app/assets/svg.tsx'),
20-
...(isProduction && !isSsrBuild && { crypto: 'crypto-browserify' })
21-
}
22-
23-
return {
24-
define: {
25-
BUILD_CDN_URL: JSON.stringify(process.env.BUILD_CDN_URL),
26-
BUILD_API_URL: JSON.stringify(process.env.BUILD_API_URL)
27-
},
28-
plugins: [
29-
cloudflare({
30-
persistState: {
31-
path: '../.wrangler/v3'
32-
}
33-
}),
34-
reactRouter(),
35-
tsconfigPaths()
36-
],
37-
resolve: {
38-
alias
39-
},
40-
build: {
41-
assetsDir: `${APP_BASEPATH.replace(/^\//, '')}/assets`,
42-
sourcemap: true,
43-
target: 'esnext',
44-
outDir: 'build'
8+
export default defineConfig(({ mode, isSsrBuild }) => ({
9+
define: {
10+
BUILD_CDN_URL: JSON.stringify(process.env.BUILD_CDN_URL),
11+
BUILD_API_URL: JSON.stringify(process.env.BUILD_API_URL)
12+
},
13+
plugins: [
14+
cloudflare({
15+
persistState: {
16+
path: '../.wrangler/v3'
17+
}
18+
}),
19+
reactRouter(),
20+
tsconfigPaths()
21+
],
22+
resolve: {
23+
alias: {
24+
'@/components': path.resolve(
25+
__dirname,
26+
'./app/components/redesign/components'
27+
),
28+
'@/typography': path.resolve(
29+
__dirname,
30+
'./app/components/redesign/Typography.tsx'
31+
),
32+
'@/assets': path.resolve(__dirname, './app/assets/svg.tsx'),
33+
...(mode === 'production' &&
34+
!isSsrBuild && { crypto: 'crypto-browserify' })
4535
}
36+
},
37+
build: {
38+
assetsDir: `${APP_BASEPATH.replace(/^\//, '')}/assets`,
39+
sourcemap: true,
40+
target: 'esnext',
41+
outDir: 'build'
4642
}
47-
})
43+
}))

0 commit comments

Comments
 (0)