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

fix: Remove 500 error if file not found #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

virus2016
Copy link

@virus2016 virus2016 commented Mar 11, 2020

Tested that fallback works as expected.

@virus2016
Copy link
Author

#43 This should fix this one ;-)

Comment on lines -38 to -45
if (error.code !== 'ENOENT') {
response.writeHead(500)
response.end('500 Internal Server Error' +
'\n\n' + filePath +
'\n\n' + Object.values(error).join('\n') +
'\n\n(rollup-plugin-serve)', 'utf-8')
return
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code was originally added to make a difference between 404 and other errors. By removing it, there are only 404s. How about changing the order instead:

if (!error) ...
-if (error.code !== 'ENOENT') ...
if (options.historyApiFallback) ...
+if (error.code !== 'ENOENT') ...
notFound()

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

Successfully merging this pull request may close these issues.

2 participants