File tree 2 files changed +13
-9
lines changed
packages/astro/src/core/build/plugins
2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " astro " : patch
3
+ ---
4
+
5
+ Fixes an issue where ` config.vite.build.assetsInlineLimit ` could not be set as a function.
Original file line number Diff line number Diff line change @@ -75,14 +75,13 @@ export function shouldInlineAsset(
75
75
assetPath : string ,
76
76
assetsInlineLimit : NonNullable < BuildOptions [ 'assetsInlineLimit' ] >
77
77
) {
78
- if ( typeof assetsInlineLimit === 'number ' ) {
79
- return Buffer . byteLength ( assetContent ) < assetsInlineLimit ;
80
- }
81
-
82
- const result = assetsInlineLimit ( assetPath , Buffer . from ( assetContent ) ) ;
83
- if ( result != null ) {
84
- return result ;
78
+ if ( typeof assetsInlineLimit === 'function ' ) {
79
+ const result = assetsInlineLimit ( assetPath , Buffer . from ( assetContent ) ) ;
80
+ if ( result != null ) {
81
+ return result ;
82
+ } else {
83
+ return Buffer . byteLength ( assetContent ) < 4096 ; // Fallback to 4096kb by default (same as Vite)
84
+ }
85
85
}
86
-
87
- return Buffer . byteLength ( assetContent ) < 4096 ; // Fallback to 4096kb by default (same as Vite)
86
+ return Buffer . byteLength ( assetContent ) < Number ( assetsInlineLimit ) ;
88
87
}
You can’t perform that action at this time.
0 commit comments