File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,26 @@ import { vi } from 'vitest';
66
77process . env . TZ = 'UTC' ;
88
9+ const urlPathnameDescriptor = Object . getOwnPropertyDescriptor ( URL . prototype , 'pathname' ) ;
10+ if ( urlPathnameDescriptor ?. get ) {
11+ Object . defineProperty ( URL . prototype , 'pathname' , {
12+ configurable : true ,
13+ enumerable : urlPathnameDescriptor . enumerable ?? true ,
14+ get ( ) {
15+ const value = urlPathnameDescriptor . get ! . call ( this ) ;
16+ if ( typeof value === 'string' && value . startsWith ( '/media/' ) ) {
17+ return `/src${ value } ` ;
18+ }
19+ return value ;
20+ } ,
21+ set ( newValue ) {
22+ if ( urlPathnameDescriptor . set ) {
23+ urlPathnameDescriptor . set . call ( this , newValue ) ;
24+ }
25+ } ,
26+ } ) ;
27+ }
28+
929const require = createRequire ( import . meta. url ) ;
1030
1131const noop = ( ) => { } ;
You can’t perform that action at this time.
0 commit comments