blob: c012b56ee875ad0055c7be98d3402b93e7dd67bd (
plain)
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
|
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'
import macros from 'unplugin-parcel-macros';
import optimizeLocales from '@react-aria/optimize-locales-plugin';
// https://vite.dev/config/
export default defineConfig({
plugins: [
macros.vite(), // Must be first!
react(),
{
...optimizeLocales.vite({ locales: ['en-US', 'zh-CN'] }),
enforce: 'pre'
}
],
build: {
target: ['es2022'],
// Lightning CSS produces a much smaller CSS bundle than the default minifier.
cssMinify: 'lightningcss',
rollupOptions: {
output: {
// Bundle all S2 and style-macro generated CSS into a single bundle instead of code splitting.
// Because atomic CSS has so much overlap between components, loading all CSS up front results in
// smaller bundles instead of producing duplication between pages.
manualChunks(id) {
if (/macro-(.*)\.css$/.test(id) || /@react-spectrum\/s2\/.*\.css$/.test(id)) {
return 's2-styles';
}
}
}
}
}
})
|