-
Notifications
You must be signed in to change notification settings - Fork 16
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
Replace WebPack build with Vite #657
base: main
Are you sure you want to change the base?
Conversation
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.
Because the project requires a HTML file to render the index page, I've copied the HTML that Vite usually spits out during development and modified it to load everything from the Vite server. This allows the production and development builds to work in the same manner without needing to result to setting up a proxy from the main server.
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.
Thanks, we definitely don't want to setup any additional proxy.
Signed-off-by: Jon Koops <[email protected]>
<meta name="theme-color" content="#000000" /> | ||
<title>Identity Management</title> | ||
<script type="module"> | ||
import { injectIntoGlobalHook } from "http://localhost:5173/ipa/modern_ui/@react-refresh"; |
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.
can this URI be replaced with something properly defined for both development and production use?
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 wonder, what exactly this snippet is doing, hot reload can also be achieved with vite plugin.
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.
This is not a file that is used in production, but purely for development, so that won't be needed.
}, | ||
}, | ||
server: { | ||
origin: "http://localhost:5173", |
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.
This is definitely something that needs to be customized per build type.
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.
This server configuration is only for the development server, this does not affect production builds.
Just a note for future us, we should ideally make sure that hot reload works even in podman containers, as NFS usually requires specific setup to work. |
When running in the containers, we bind-mount the volume instead of using NFS. That's taken care of, basically. |
@@ -26,14 +26,14 @@ | |||
"@testing-library/react": "^12.1.5", | |||
"@testing-library/user-event": "^13.5.0", | |||
"@types/jest": "^29.5.10", | |||
"@types/node": "^16.11.45", | |||
"@types/node": "^22.13.5", |
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 wonder if this version of NodeJS would affect compatibility with other libraries and React v.17. We are considering upgrading those soon but not sure if in the meantime they might still throw some warnings or affect some functionality.
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.
This is just types, should be alright, the node version is set by OS or env, we should definitely check up what node version is the OS running by default and try to sync the types.
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.
This should not affect anything except types themselves, the build step also runs the TypeScript compiler to verify the types are correct, so any regressions should be caught on CI.
Replaces the WebPack build with Vite, speeding up the building process and making it more future proof.