lostcarpark / conclar

ConClár Programme Guide in ReactJS
MIT License
11 stars 12 forks source link

Improve non-production build in subdirectory #85

Open mcdemarco opened 2 years ago

mcdemarco commented 2 years ago

You can view the npm start build on the built-in webserver at its subdirectory (e.g., http://localhost:3000/conclar/), but some processes fail. Most notably, the info page doesn't render properly. (It shows the raw html of the index page.) The request for head.svg also seems to fail.

On a related topic, during integration of conclar with some other processes at Boskone, I got a request for a setup that used relative paths instead of the hard-coded path setup. I don't know whether that's possible; I don't think it can work for the .htaccess file but maybe it could work in most other places. We did not have time to experiment with that.

lostcarpark commented 2 years ago

I've tested on a fresh clone of ConClár, and it seems to work for me. Some things to note:

That could probably be clarified in the readme.

I'll investigate whether relative paths are possible, as they would simplify configuration.

mcdemarco commented 2 years ago

All the paths are set correctly and work correctly in a production build. These seem to be processes that depend on the mod_rewrite setup, since they also fail in the same way when serving a production build without mod_rewrite set up. What version of the node server are you running with npm start and might mine be different?

lostcarpark commented 2 years ago

Ah, that could be the issue. React Router needs the webserver to support URL rewriting. That's mod_rewrite for Apache, but the dev server isn't Apache, so may not be support it on all versions. I am running Node version 17.5.0, and npm version 8.4.1, which is the "latest" on NodeJS website. When I get a chance I'll try installing the LTS version in a docker.

mcdemarco commented 2 years ago

I'm on node 14. I'll see if updating helps, thanks!

lostcarpark commented 2 years ago

Ah. 14 is definitely a little old, though still in maintenance support. I would suggest trying 16 or 17.

mcdemarco commented 2 years ago

I think the upgrade fixed most things, although the info page still doesn't render unless there's a slash at the end of the subdirectory name (a case that the Apache config handles automatically).