Skip to content

Commit c3fbbef

Browse files
hulkishgregberge
authored andcommitted
perf: use more performant url join impl (#353)
1 parent 86171ec commit c3fbbef

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Diff for: packages/server/src/util.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ export const smartRequire = modulePath => {
1717
return eval('module.require')(modulePath)
1818
}
1919

20-
export const joinURLPath = (...paths) => {
21-
const cleanPaths = paths.map(path => path.replace(/\/$/, ''))
22-
return cleanPaths.join('/')
20+
export const joinURLPath = (publicPath, filename) => {
21+
if (publicPath.substr(-1) === '/') {
22+
return `${publicPath}${filename}`
23+
}
24+
25+
return `${publicPath}/${filename}`
2326
}

0 commit comments

Comments
 (0)