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 {
1010 load : async ( id ) => {
1111 if ( ! import . meta. env . __vite_rsc_build__ ) {
1212 // @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+ )
1416 } else {
1517 const import_ = clientReferences . default [ id ]
1618 if ( ! import_ ) {
@@ -21,3 +23,12 @@ function initialize(): void {
2123 } ,
2224 } )
2325}
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