Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSR will always add a '/' before assets url even if the publicPath is empty #8167

Closed
meteorlxy opened this issue May 10, 2018 · 0 comments · Fixed by #8177
Closed

SSR will always add a '/' before assets url even if the publicPath is empty #8167

meteorlxy opened this issue May 10, 2018 · 0 comments · Fixed by #8177
Assignees

Comments

@meteorlxy
Copy link
Member

meteorlxy commented May 10, 2018

Version

2.5.17-beta.0

Reproduction link

https://github.com/vuejs/vue/blob/2efc0446b3ac1f18fff8b59215e7b60d51c41965/src/server/template-renderer/index.js

Steps to reproduce

No need to repro, it's written in the code.

? cssFiles.map(file => `<link rel="stylesheet" href="${this.publicPath}/${file}">`).join('')

return `<link rel="preload" href="${
this.publicPath}/${file
}"${

return `<link rel="prefetch" href="${this.publicPath}/${file}" as="script">`

return `<script src="${this.publicPath}/${file}"></script>`

href="${this.publicPath}/${file}"
src="${this.publicPath}/${file}"

The publicPath of webpackConfig.output could be empty, and it is resonable.

What is expected?

  • publicPath = '' generates assets/css/xxx
  • publicPath = '/' generates/assets/css/xxx

They are rather different

What is actually happening?

  • publicPath = '' and publicPath = '/' both generate /assets/css/xxx

So we could introduce an extra judgement for this.publicPath === ''

Or we could just use publicPath directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants