From 481402e09fe760634b826b09e302e2e1bfec88b1 Mon Sep 17 00:00:00 2001 From: shu Date: Mon, 7 Sep 2026 15:48:36 +0800 Subject: feat: initialize React Spectrum template with layouts and showcases --- vite.config.ts | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 vite.config.ts (limited to 'vite.config.ts') 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'; + } + } + } + } + } +}) -- cgit v1.2.3