File tree 1 file changed +12
-10
lines changed
1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,16 @@ export async function build({
14
14
minify = Bun . env . NODE_ENV === "production" ,
15
15
define,
16
16
plugins,
17
+ onLoadPageFile = async ( { path, loader } ) => {
18
+ const contents = await Bun . file ( path ) . text ( ) ;
19
+ return {
20
+ contents : contents . replaceAll (
21
+ / \/ \/ \s * @ s e r v e r - s i d e [ ^ \n \S ] * \n [ ^ \n ] + \n / g,
22
+ ""
23
+ ) ,
24
+ loader,
25
+ } ;
26
+ } ,
17
27
} : {
18
28
baseDir : string ;
19
29
buildDir ?: string ;
@@ -23,6 +33,7 @@ export async function build({
23
33
minify ?: boolean ;
24
34
define ?: Record < string , string > ;
25
35
plugins ?: import ( "bun" ) . BunPlugin [ ] ;
36
+ onLoadPageFile ?: import ( "bun" ) . OnLoadCallback ;
26
37
} ) {
27
38
const entrypoints = [ join ( baseDir , hydrate ) ] ;
28
39
const absPageDir = join ( baseDir , pageDir ) ;
@@ -81,16 +92,7 @@ export async function build({
81
92
) ;
82
93
build . onLoad (
83
94
{ namespace : "client" , filter : / \. t s [ x ] $ / } ,
84
- async ( { path, loader } ) => {
85
- const contents = await Bun . file ( path ) . text ( ) ;
86
- return {
87
- contents : contents . replaceAll (
88
- / \/ \/ \s * @ s e r v e r - s i d e [ ^ \n \S ] * \n [ ^ \n ] + \n / g,
89
- ""
90
- ) ,
91
- loader,
92
- } ;
93
- }
95
+ onLoadPageFile
94
96
) ;
95
97
} ,
96
98
} ,
You can’t perform that action at this time.
0 commit comments