-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
HTML bundle serving bug. #974
Conversation
Codecov Report
@@ Coverage Diff @@
## master #974 +/- ##
=========================================
- Coverage 89.46% 88.6% -0.86%
=========================================
Files 68 68
Lines 3341 3440 +99
=========================================
+ Hits 2989 3048 +59
- Misses 352 392 +40
Continue to review full report at Codecov.
|
src/Server.js
Outdated
@@ -49,6 +50,11 @@ function middleware(bundler) { | |||
} else { | |||
// Otherwise, serve the file from the dist folder | |||
req.url = req.url.slice(bundler.options.publicURL.length); | |||
// If we're serving an html bundle, and the requested path has not file | |||
// extension, serve the index.html. Otherwise go to the file server. | |||
if (bundler.mainAsset.type === 'html' && path.extname(req.url) == "") { |
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 would break any file that doesn't have an extension?
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.
Currently only HTML is served, so it wouldn't change the behavior. But it's true that it will not serve files without extensions - I'd argue that is desired behavior for single page apps.
@ry @DeMoorJasper Is this a duplicate of #838? I noticed that #838 closes this PR 🤔 🤷♂️ |
When serving HTML bundle with publicUrl="/", allow the server to send static assets other than html.
Thanks! |
When serving HTML bundle with publicUrl="/", allow the server to send static assets other than html.
Fixes #782