-
Notifications
You must be signed in to change notification settings - Fork 2
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] 'route/:id' refresh issue by removing explicit 'base' from vite… #140
base: main
Are you sure you want to change the base?
Conversation
Seems like you are not returning |
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. |
@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. Current state: works on dev, prod and dockerization |
@@ -3,7 +3,7 @@ RECORD_MANAGER_APP_TITLE=Record Manager | |||
RECORD_MANAGER_APP_INFO= | |||
RECORD_MANAGER_LANGUAGE=cs | |||
RECORD_MANAGER_NAVIGATOR_LANGUAGE=true | |||
RECORD_MANAGER_BASENAME=/ | |||
RECORD_MANAGER_BASENAME=/record-manager |
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.
What is motivation to change this?
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.
@blcham Because I thought of every environment (dev, production) having it's own base in vite.config.js which will use the value of the RECORD_MANAGER_BASENAME based on mode. So the dev environment will have a "/" base, and the production will have a "/record-manager" base . Since the build for production image is then used in dockerization, it means that the base of the build (in vite.config.js) should match with the BASENAME passed via docker (which will be /record-manager, since RECORD_MANAGER_ROOT_PATH in deploy > internal-auth > .env is commented out). https://reactrouter.com/en/main/router-components/router
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.
So what if i decide to have RECORD_MANAGER_ROOT_PATH=/my-record-manager
?
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.
@blcham It doesn't work after I changed it, I feel stuck now
const env = loadEnv(mode); | ||
|
||
return defineConfig({ | ||
base: env.RECORD_MANAGER_BASENAME, |
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.
I might not understand how it works, but
this seems to me strange to use. I thought we had environments set up in
record-manager-ui/config/index.js
Line 33 in 9f44702
export const BASENAME = getEnv("BASENAME", ""); |
So I am not sure how this setting is useful for us. I thought we would set Router basename instead.
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.
I assume (but did not check) vite.config.js base
attribute is set during build time and thus is useless for us for dockerization.
I did not test the dockerization, but I have doubts about the solution. I have questions:
|
d9935a7
to
c0c7331
Compare
…m vite.config.js (default is '/')
…g on the environment;
c0c7331
to
feec894
Compare
@blcham solving #125
It works with dev and build. But not in the dockerization, working on it