@@ -4,6 +4,7 @@ import react from "@astrojs/react";
44import sitemap from "@astrojs/sitemap" ;
55import sanity from "@sanity/astro" ;
66import { defineConfig , passthroughImageService } from "astro/config" ;
7+ import tsconfigPaths from "vite-tsconfig-paths" ;
78
89export default defineConfig ( {
910 output : "server" ,
@@ -34,6 +35,53 @@ export default defineConfig({
3435 format : "file" ,
3536 } ,
3637 vite : {
38+ build : {
39+ rollupOptions : {
40+ output : {
41+ // Use a supported file pattern for Vite 5/Rollup 4
42+ // @doc https://relative-ci.com/documentation/guides/vite-config
43+ assetFileNames : "assets/[name].[hash][extname]" ,
44+ chunkFileNames : "assets/[name].[hash].js" ,
45+ entryFileNames : "assets/[name].[hash].js" ,
46+ manualChunks ( id ) {
47+ // Astro
48+ if ( id . includes ( "astro" ) || id . includes ( "@astrojs" ) ) {
49+ return "astro" ;
50+ }
51+
52+ // Core component primitives
53+ if (
54+ id . includes ( "@radix-ui" ) ||
55+ id . includes ( "react-aria" ) ||
56+ id . includes ( "react-aria-components" )
57+ ) {
58+ return "react-aria" ;
59+ }
60+
61+ // Icons and visual components
62+ if ( id . includes ( "@maskito" ) || id . includes ( "@remixicon" ) ) {
63+ return "ui-components" ;
64+ }
65+
66+ // USA states and counties dictionary
67+ if ( id . includes ( "typed-usa-states" ) ) {
68+ return "usa-states" ;
69+ }
70+
71+ // PDF lib
72+ if ( id . includes ( "@cantoo/pdf-lib" ) ) {
73+ return "pdf" ;
74+ }
75+
76+ // Analytics
77+ if ( id . includes ( "posthog-js" ) ) {
78+ return "analytics" ;
79+ }
80+ } ,
81+ } ,
82+ } ,
83+ } ,
84+ plugins : [ tsconfigPaths ( ) ] ,
3785 ssr : {
3886 external : [ "buffer" , "path" , "fs" , "os" , "crypto" , "async_hooks" ] . map (
3987 ( i ) => `node:${ i } ` ,
0 commit comments