File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,9 @@ function initialize(): void {
10
10
load : async ( id ) => {
11
11
if ( ! import . meta. env . __vite_rsc_build__ ) {
12
12
// @ts -ignore
13
- return __vite_rsc_raw_import__ ( import . meta. env . BASE_URL + id . slice ( 1 ) )
13
+ return __vite_rsc_raw_import__ (
14
+ withTrailingSlash ( import . meta. env . BASE_URL ) + id . slice ( 1 ) ,
15
+ )
14
16
} else {
15
17
const import_ = clientReferences . default [ id ]
16
18
if ( ! import_ ) {
@@ -21,3 +23,12 @@ function initialize(): void {
21
23
} ,
22
24
} )
23
25
}
26
+
27
+ // Vite normalizes `config.base` to have trailing slash, but not for `import.meta.env.BASE_URL`.
28
+ // https://github.com/vitejs/vite/blob/27a192fc95036dbdb6e615a4201b858eb64aa075/packages/vite/src/shared/utils.ts#L48-L53
29
+ function withTrailingSlash ( path : string ) : string {
30
+ if ( path [ path . length - 1 ] !== '/' ) {
31
+ return `${ path } /`
32
+ }
33
+ return path
34
+ }
You can’t perform that action at this time.
0 commit comments