【问题标题】:Nuxt.js SPA devserver settingsNuxt.js SPA 开发服务器设置
【发布时间】:2019-05-16 09:50:35
【问题描述】:

我之前在 vue-config.js 中配置过 devserver 是这样的:

devServer: {
  proxy: {
    "/api/*": {
      target: "http://localhost:3001",
      secure: false
    }
  }
}

在 nuxt-SPA 中这不起作用。我的前端仍在向同源 localhost:3000 发送 API 调用。如何配置对不同端口的 API 调用?

【问题讨论】:

    标签: vue.js nuxt.js


    【解决方案1】:

    重复 How to use webpack dev proxy with Nuxt https://github.com/nuxt/nuxt.js/issues/762

    由于其通用的应用性质,Nuxts 没有 webpack 代理。

    最简单的实现在这里 - https://github.com/nuxt-community/proxy-module

    【讨论】:

      猜你喜欢
      • 2018-06-18
      • 1970-01-01
      • 1970-01-01
      • 2013-06-07
      • 2017-08-18
      • 2016-12-17
      • 2016-07-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多