无法重新导出命名的导出“模块名称” node_modules / graphql / index.mjs => Vue CLI 3 + Apollo

时间:2018-11-27 10:26:13

标签: vue.js graphql apollo

const apolloProvider = new VueApollo({ defaultClient })

Vue.config.productionTip = false

new Vue({
  provide: apolloProvider.provide(),
  router,
  store,
  render: h => h(App)
}).$mount('#app')
  

将ApolloBoost集成到Vue CLI 3中时出现问题。它说:“无法从非EcmaScript模块中重新导出命名的导出'visitInParallel'(仅默认导出可用)。./node_modules / graphql / index.mjs”

以下是我尝试过的不同方法:
 1.我尝试配置vue.config.js
 2.使用node --experimental-module ../ node_modules / graphql / index.mjs

难怪为什么它不起作用。

1 个答案:

答案 0 :(得分:0)

我解决此问题的方法是安装 vue-cli-plugin-apollo

npm install vue-cli-plugin-apollo
or
yarn add vue-cli-plugin-apollo

也许vue-cli需要 vue-cli-plugin-apollo 才能使用vue-apollo。