File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -188,13 +188,12 @@ export const transformHtml = (code: string) => {
188188const rewriteAppendChild = ( base : string ) => {
189189 const rawAppendChild = Node . prototype . appendChild ;
190190 Node . prototype . appendChild = function < T extends Node > ( node : T ) : T {
191- if (
192- node instanceof HTMLLinkElement &&
193- node . rel === 'prefetch' &&
194- node . href . startsWith ( '/assets/' )
195- ) {
196- node . href = base + node . href ;
191+ if ( node instanceof HTMLLinkElement && node . rel === 'prefetch' ) {
192+ const href = node . getAttribute ( 'href' ) ;
193+ if ( href && href . startsWith ( '/assets/' ) ) {
194+ node . href = base + href ;
195+ }
197196 }
198- return rawAppendChild . call ( this , node ) as T
197+ return rawAppendChild . call ( this , node ) as T ;
199198 } ;
200199} ;
You can’t perform that action at this time.
0 commit comments