diff options
| author | shu <nvcsadjkojf@outlook.com> | 2026-09-07 15:48:36 +0800 |
|---|---|---|
| committer | shu <nvcsadjkojf@outlook.com> | 2026-09-07 15:48:36 +0800 |
| commit | 481402e09fe760634b826b09e302e2e1bfec88b1 (patch) | |
| tree | 9b55025bfcd6acd2c5d795f057de27028b422603 /vite.config.ts | |
feat: initialize React Spectrum template with layouts and showcases
Diffstat (limited to 'vite.config.ts')
| -rw-r--r-- | vite.config.ts | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..c012b56 --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,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'; + } + } + } + } + } +}) |
