vue.js - vue.config.js 无法识别 - 404 错误
问题描述
Vue 配置文件未被识别并引发 404 错误。基于本教程:https ://www.youtube.com/watch?v=W-b9KGwVECs
vue.config.js
const path = require("path");
module.exports = {
devServer: {
proxy: {
//if usere requests /api path, then we add a proxy for localhost5000
// If your frontend app and the backend API server are not running on the same host,
// you will need to proxy API requests to the API server during development.
"^/api": {
target: "http://localhost:5000",
changeOrigin: true,
pathRewrite: { "^/api": "/" },
},
},
},
};
它位于我的前端文件夹的根目录中。我的 Vue cli 版本是 @vue/cli 4.5.6
最初我使用这个完美连接前端和后端的url const url = "http://localhost:5000/api/posts/";
有什么我想念的吗?谢谢!