@@ -60,7 +60,7 @@ export default class TemplateRenderer {
60
60
// extra functionality with client manifest
61
61
if ( options . clientManifest ) {
62
62
const clientManifest = this . clientManifest = options . clientManifest
63
- this . publicPath = clientManifest . publicPath . replace ( / \/ $ / , '' )
63
+ this . publicPath = clientManifest . publicPath
64
64
// preload/prefetch directives
65
65
this . preloadFiles = ( clientManifest . initial || [ ] ) . map ( normalizeFile )
66
66
this . prefetchFiles = ( clientManifest . async || [ ] ) . map ( normalizeFile )
@@ -114,7 +114,7 @@ export default class TemplateRenderer {
114
114
return (
115
115
// render links for css files
116
116
( cssFiles . length
117
- ? cssFiles . map ( ( { file } ) => `<link rel="stylesheet" href="${ this . publicPath } / ${ file } ">` ) . join ( '' )
117
+ ? cssFiles . map ( ( { file } ) => `<link rel="stylesheet" href="${ this . getPublicPath ( file ) } ">` ) . join ( '' )
118
118
: '' ) +
119
119
// context.styles is a getter exposed by vue-style-loader which contains
120
120
// the inline component styles collected during SSR
@@ -153,7 +153,7 @@ export default class TemplateRenderer {
153
153
extra = ` type="font/${ extension } " crossorigin`
154
154
}
155
155
return `<link rel="preload" href="${
156
- this . publicPath } / ${ file
156
+ this . getPublicPath ( file )
157
157
} "${
158
158
asType !== '' ? ` as="${ asType } "` : ''
159
159
} ${
@@ -179,7 +179,7 @@ export default class TemplateRenderer {
179
179
if ( alreadyRendered ( file ) ) {
180
180
return ''
181
181
}
182
- return `<link rel="prefetch" href="${ this . publicPath } / ${ file } ">`
182
+ return `<link rel="prefetch" href="${ this . getPublicPath ( file ) } ">`
183
183
} ) . join ( '' )
184
184
} else {
185
185
return ''
@@ -206,7 +206,7 @@ export default class TemplateRenderer {
206
206
const async = ( this . getUsedAsyncFiles ( context ) || [ ] ) . filter ( ( { file } ) => isJS ( file ) )
207
207
const needed = [ initial [ 0 ] ] . concat ( async || [ ] , initial . slice ( 1 ) )
208
208
return needed . map ( ( { file } ) => {
209
- return `<script src="${ this . publicPath } / ${ file } " defer></script>`
209
+ return `<script src="${ this . getPublicPath ( file ) } " defer></script>`
210
210
} ) . join ( '' )
211
211
} else {
212
212
return ''
@@ -228,6 +228,10 @@ export default class TemplateRenderer {
228
228
}
229
229
return new TemplateStream ( this , this . parsedTemplate , context || { } )
230
230
}
231
+
232
+ getPublicPath ( file : string ) {
233
+ return path . posix . join ( this . publicPath , file )
234
+ }
231
235
}
232
236
233
237
function normalizeFile ( file : string ) : Resource {
0 commit comments