File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
Expand file tree Collapse file tree 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({
1414 minify = Bun . env . NODE_ENV === "production" ,
1515 define,
1616 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+ } ,
1727} : {
1828 baseDir : string ;
1929 buildDir ?: string ;
@@ -23,6 +33,7 @@ export async function build({
2333 minify ?: boolean ;
2434 define ?: Record < string , string > ;
2535 plugins ?: import ( "bun" ) . BunPlugin [ ] ;
36+ onLoadPageFile ?: import ( "bun" ) . OnLoadCallback ;
2637} ) {
2738 const entrypoints = [ join ( baseDir , hydrate ) ] ;
2839 const absPageDir = join ( baseDir , pageDir ) ;
@@ -81,16 +92,7 @@ export async function build({
8192 ) ;
8293 build . onLoad (
8394 { 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
9496 ) ;
9597 } ,
9698 } ,
You can’t perform that action at this time.
0 commit comments