cookiecutter-django-vue
cookiecutter-django-vue copied to clipboard
Vue 3
Greetings, are you considering switching to Vue 3 in the near future?
I've gotten to a point where I'm at least getting errors shown in the TypeScript of Vue3 when I run docker-compose up --build, so I figured I'd put the steps I've taken and maybe others would like to discuss (I'm very new to Vue, and am hoping to convert this over so that I can use it for fullstack learning purposes).
Sources:
- https://www.johnpapa.net/vue2-to-vue3/ - John Papa
- https://www.vuemastery.com/blog/vue-3-migration-build/ - Vue Mastery (learn about migration)
- https://www.vuemastery.com/blog/migration/ - Vue Mastery (fixes after migration)
Steps:
- Make sure that your project works as directed in the readme and you can run
docker-compose up --build- You want to run
docker-compose run frontend npm iinstead ofnpm iwithinfrontend - For the backend
requirements.txtI found I needed to removeidna==3.1as it was causing version conflicts. - You can also upgrade Django to v4.0.6 and upgrade a few packages that have security errors at this point (Pillow, ipython and urllib3)
- You want to run
- Firstly, we can update some of the Docker images. The following still are support images at time of writing:
- postgres:10-alpine -> postgres:10.21-alpine (some later versions are not working)
- node:10-alpine -> node:14-alpine (needed as later npm versions don't run on Node 10)
- nginx:alpine -> nginx:1.22.0-alpine
- At this point I'd suggest committing to version control as there will be lots of automatic changes. Based on the first source, within the generated
frontenddirectory run the following:
# In ./frontend:
vue add vue-next # switches to Vue3
vue add typescript # choose defaults to convert all JS to TS
- To fix npm compatibility issues do the following within
frontend:
npm install -g npm@latest # fixes error as seen in https://github.com/m-muhsin/celestial/issues/9
# Also of help for the above could be to run the following to reset the node modules and package-lock.json
rm -rf node_modules package-lock.json && npm install
- At one point I was getting the error
Cannot find module 'vue-template-compiler/package.json', so based on vuejs/vue-cli#2109 I ran the following infrontend:
npm i -g @vue/compiler-sfc
At this point when I run docker-compose up --build I'm getting TS errors. Again I'd be very happy to discuss or get some feedback on the above :)
I'm considering moving to other options at the moment, but again talking about the above would be helpful.