aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/vite.config.ts
diff options
context:
space:
mode:
authorshu <nvcsadjkojf@outlook.com>2026-09-07 15:48:36 +0800
committershu <nvcsadjkojf@outlook.com>2026-09-07 15:48:36 +0800
commit481402e09fe760634b826b09e302e2e1bfec88b1 (patch)
tree9b55025bfcd6acd2c5d795f057de27028b422603 /vite.config.ts
feat: initialize React Spectrum template with layouts and showcases
Diffstat (limited to 'vite.config.ts')
-rw-r--r--vite.config.ts33
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';
+ }
+ }
+ }
+ }
+ }
+})