generated from hackforla/.github-hackforla-base-repo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
✨Feature: Vite HMR in development mode + Vite backend django integration #564
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JimmyJuarez10
requested review from
JimmyJuarez10
and removed request for
Anahisv23 and
RojaPinnamraju
September 13, 2024 03:24
JimmyJuarez10
approved these changes
Sep 13, 2024
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.
Approved on 09/12 Meeting
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #563
Changes
Big changes:
django-vite
package in the backend: https://github.com/MrBin99/django-vitedocker-compose.dev.yml
file for quickly booting up the dev environment on your local machine.docker-compose.yml
file to be honest. It wasn't working for me.dev/vite.Dockerfile
and adev/django.Dockerfile
for building separate containers for the frontend and backed.django.dockerfile
:Try it yourself
How to run the new full stack CivicTechJobs application in development mode?
http://localhost:8000
in your browserfrontend/src/pages/LandingPage/LandingPageIntro.tsx
How does the new vite backend integration work?
Vite dev server
$ vite dev
inside the/frontend
directory will start a vite development server with fast Hot Module Reload enabled.settings.py
file is configured to load js modules from the dev server inDEBUG
mode (aka dev mode).django-vite
PyPI package.django-vite
is set to fill in yourindex.html
template with vite js modules for you.Production bundle - NEEDS REVIEW
$ vite build
inside the/frontend
directory will create a build directly in the django backend.backend/vite_assets_dist
.Changes by file:
./.dockerignore
- added the vite build files and tidied up a bit./.gitignore
- ignore the vite build filesbackend/settings.py
- configured environment variables and set up django-vite integrationbackend/urls.py
- add a path for the newindex.html
templatebackend/poetry.lock
- addeddjango-vite
andpython-decouple
packagesbackend/pyproject.toml
- addeddjango-vite
andpython-decouple
packagesbackend/templates/index.html
- moved the index.html template from the frontend to the django backend, where it makes more sense to keep.dev/django.Dockerfile
- new dockerfile for building the django dev environment docker imagedev/vite.Dockerfile
- new dockerfile for building the vite development server docker image./docker-compose.dev.yml
- new compose file for running the application in development modefrontend/.gitignore
- ignorevite.config.mts.timestamp...
- this temp file is created when you run$ vite dev
, but sometimes it does not get removed after.frontend/package.json
- removevite-plugin-html
package, it is no longer neededfrontend/package-lock.json
- removevite-plugin-html
package, it is no longer neededfrontend/src/index.tsx
- importvite/modulepreload-polyfill
- necessary for vite backend integration.frontend/src/templates/vite-index.html
- removed this file as it is no longer neededfrontend/vite.config.mts
- configured vite settings to integrate with django backend and docker compose.Screenshots, if applicable
No changes to the website's appearance.