-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Redirect to index in webpack-dev-server if assetsPublicPath is set (close #915) #980
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
base: develop
Are you sure you want to change the base?
Conversation
When assetsPublicPath is set, index.html and other files are server from this path and not from the root. Starting webpack-dev-serve in this case is showing a blank page on the root url. This change adds a redirection from the root url to assetsPublicPath for convenience.
template/build/webpack.dev.conf.js
Outdated
}, | ||
before: function(app) { | ||
// Redirect to index.html in assetsPublicPath if path is not set to root | ||
if (config.dev.assetsPublicPath && config.dev.assetsPublicPath != '/') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I think
!==
is better, stylistically. - Just thinking: Could this break anything for a relative path ('./')?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this (comment above this one for the same line) has to be tested before merge.
template/build/webpack.dev.conf.js
Outdated
}, | ||
before: function(app) { | ||
// Redirect to index.html in assetsPublicPath if path is not set to root | ||
if (config.dev.assetsPublicPath && config.dev.assetsPublicPath != '/') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this (comment above this one for the same line) has to be tested before merge.
When assetsPublicPath is set, index.html and other files are server from this path
and not from the root. Starting webpack-dev-serve in this case is showing a blank
page on the root url. This change adds a redirection from the root url to
assetsPublicPath for convenience.