Skip to content

Commit 54858b4

Browse files
authored
fix(turbopack): runtimePublic prefix deal (#67)
1 parent 5ca68b4 commit 54858b4

File tree

1 file changed

+4
-1
lines changed
  • turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/base

1 file changed

+4
-1
lines changed

turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/base/runtime-base.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,12 @@ function getPathFromScript(
377377
: chunkScript.getAttribute('src')!
378378
const src = decodeURIComponent(chunkUrl.replace(/[?#].*$/, ''))
379379
const runtimeBasePath = getRuntimeChunkBasePath()
380-
const path = src.startsWith(runtimeBasePath)
380+
let path = src.startsWith(runtimeBasePath)
381381
? src.slice(runtimeBasePath.length)
382382
: src
383+
if (path.startsWith('/')) {
384+
path = path.slice(1)
385+
}
383386
return path as ChunkPath | ChunkListPath
384387
}
385388

0 commit comments

Comments
 (0)