I want to write a single-page web UI using Flask (and Flask-RESTful) for a REST back-end, and Vue.js for the front-end. The problem is, I'm having a hard time using the two together during development.
I can build Vue components using vue build --prod ... to obtain a JS file that I can serve as a static file using Flask's web server. This file, however, is optimized for production. Without --prod, vue build starts a web server directly, which means that if I start flask run, JS code is served from a different port than my REST backend, which makes it impossible to use (same origin policy).
So my question is: How can I use Flask and Vue.js together during development?
How can I make vue build spit out non-optimized JS files that Flask can serve?
Build in development mode:
vue-cli-service build --mode development
来源:https://stackoverflow.com/questions/44953798/how-can-i-make-vue-build-spit-out-non-optimized-js-files