Hi.
I'm using serve to develop and test SPA, so I run it with -s option.
However, when I use -s, it seems not to support normal html files.
My directory to open has index.html for SPA and a normal html file for documentation.
But when I open the normal html file, it seems to be redirected another path.
Could you check it, please?
The default config uses cleanUrls for filenames ending in .html. Have you tried disabling it? https://github.com/zeit/serve-handler#cleanurls-booleanarray
Exactly. Please do it like @denkristoffer suggested and disable the option (or pass an array to only allow the feature on certain paths)... 馃槉
Thank you @danielking and @leo .
After using serve.json, I can often my doc.html file.
By the way, I have an issue related this.
When I open http://localhost:3000/doc.html, sometimes doc.html is not opened well.
At that time, chrome dev-tool shows different behaviors.
< Good case >

< Bad case >

My build folder which I use with serve has service-worker.js file. (I guess it is produced by react.)
I guess it makes this situation.
How can I see doc.html all the time?
I'm facing this same problem but using serve in the command line:
serve -s build
Is there any way to override this option using the command line?
I agree with @donmccurdy (https://github.com/zeit/serve/issues/401#issuecomment-394890378) that cleanUrls should be false by default, and you should provide a --no-clean-urls (or similar) option for command line.
Also, I couldn't find any documentation at all about using serve in the command line.
Thank you for your advice, @abelosorio .
I already used cleanUrls: false with serve.json file in my build directory.
{
"cleanUrls": false
}
The message from my execution shows it applied well.
$ serve -s -l 3001 build
INFO: Discovered configuration in `serve.json`
INFO: Accepting connections at http://localhost:3001
But, this issue still occurs.
Hi @jaeseok-park, that's weird. I've used the same workaround and it worked for me...
The situation seems to be caused by timing issue.
I meet the bad case at almost times.
But, if I open the chrome dev-tool's network tab and I refresh my page with CTRL-F5, I can meet the good case sometime.
Hi @leo, would you please review this issue?
As you can read above I fixed the issue using the serve.json file with the cleanUrls: false option, but @jaeseok-park reported the same workaround with different results.
Thanks in advance
Most helpful comment
I agree with @donmccurdy (https://github.com/zeit/serve/issues/401#issuecomment-394890378) that
cleanUrlsshould befalseby default, and you should provide a--no-clean-urls(or similar) option for command line.Also, I couldn't find any documentation at all about using
servein the command line.