-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
executable file
·84 lines (82 loc) · 3.25 KB
/
Copy pathvite.config.ts
File metadata and controls
executable file
·84 lines (82 loc) · 3.25 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import { resolve } from 'path'
import { defineConfig } from 'vite'
import dts from 'vite-plugin-dts'
export default defineConfig(({ mode }) => {
const isDevelopment = mode === 'development'
const isProduction = mode === 'production'
return {
define: {
'process.env': {}
},
esbuild: {
// jsxFactory: 'h',
// jsxFragment: 'Fragment'
},
plugins: [
dts({
outDir: './dist/types',
tsconfigPath: './tsconfig.json',
rollupTypes: false,
copyDtsFiles: false,
exclude: ['**/*.test.*', '**/*.spec.*']
})
],
build: {
outDir: 'dist',
chunkSizeWarningLimit: 1600,
sourcemap: true, // Always generate external sourcemaps for debugging
minify: isProduction ? 'esbuild' : false, // Only minify in production
lib: {
entry: resolve(__dirname, './src/index.ts'),
name: 'formular.dev',
formats: ['es', 'cjs'],
fileName: (format) => `formular-dev.${format === 'es' ? 'mjs' : 'cjs'}`,
cssFileName: 'formular-dev'
},
rollupOptions: {
// Externalize deps that shouldn't be bundled into the library
external: ['formular.design.system'],
output: {
// Provide global variables to use in the UMD build
globals: {},
// Enhanced source map configuration for development
...(isDevelopment && {
sourcemap: true,
sourcemapExcludeSources: false // Include original sources in source maps
}),
// Only preserve modules in development for debugging, but with limits
...(isDevelopment && {
preserveModules: false, // Disable for now to prevent excessive chunks
manualChunks: undefined
})
}
},
// Development-specific optimizations
...(isDevelopment && {
watch: {
buildDelay: 100,
clearScreen: false
}
}),
// Production-specific optimizations
...(isProduction && {
reportCompressedSize: true,
chunkSizeWarningLimit: 500
})
},
resolve: {
alias: {
'@tests': resolve(__dirname, './src/__tests__'),
'@mocks': resolve(__dirname, './src/mocks'),
'@core': resolve(__dirname, './src/core'),
'@setup': resolve(__dirname, './src/setup'),
'@fields': resolve(__dirname, './src/core/fields'),
'@factory': resolve(__dirname, './src/core/factory'),
'@framework': resolve(__dirname, './src/core/framework'),
'@utility': resolve(__dirname, './src/core/framework/utility'),
'@common': resolve(__dirname, './src/core/framework/common'),
'@utils': resolve(__dirname, './src/utils')
}
}
}
})