kbss-cvut / record-manager-ui

GNU Lesser General Public License v3.0
0 stars 2 forks source link

[fix] 'route/:id' refresh issue by removing explicit 'base' from vite… #140

Open shellyear opened 5 months ago

shellyear commented 5 months ago

@blcham solving https://github.com/kbss-cvut/record-manager-ui/issues/125

It works with dev and build. But not in the dockerization, working on it

blcham commented 5 months ago

Seems like you are not returning config.js but index.html (i.e. config.js is search in different path)

shellyear commented 5 months ago

Seems like you are not returning config.js but index.html (i.e. config.js is search in different path)

Yes, the build(production) and dev need the "base" property in vite.config.js to be default "/", but the build for the dockerization should have "base" property as "/record-manager/", because of how it's set in docker-compose.

shellyear commented 5 months ago

@blcham Vite serves the app from the root path (/) by default for the dev and production (base: '/' in vite.config.js) . When build for production, Vite generates the assets with paths relative to the specified base. The docker-compose.yml > record-manager > environment has a BASENAME custom environment variable which will be then used in config.js.template in .docker folder and written to config.js and then the BASENAME variable will be used in the source code for the react-router as it's property in App.js. The base in vite.config.js and in the BASENAME should match https://v5.reactrouter.com/web/api/BrowserRouter/basename-string

Current state: works on dev, prod and dockerization

blcham commented 5 months ago

Current state: works on dev, prod and dockerization

I did not test the dockerization, but I have doubts about the solution. I have questions: 1) do setting BASENAME really work in runtime? I.e. i should be possible to do only the following steps: