You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I add Apollo client in main.ts, like this:
const app = createApp(App);
// HTTP connection to the API
let url = import.meta.env.VITE_NODE_API + '/graphql';
console.log(url)
const httpLink = createHttpLink({
// You should use an absolute URL here
uri: url,
})
// Cache implementation
const cache = new InMemoryCache()
// Create the apollo client
const apolloClient = new ApolloClient({
link: httpLink,
cache,
})
const apolloProvider = createApolloProvider({
defaultClient: apolloClient,
})
app.use(apolloProvider).use(ElementPlus).use(Vant).use(store).use(router).mount('#app')
Then I run my vue project. The following error occurs
Versions
vue:3.2.25
vue-apollo: I don't konw
@apollo/client:3.8.7
I discovered the cause of the error, When vue compile node_modules/graphql/jsutils/instanceOf.mjs,the globalThis.process.env.NODE_ENV will be converted to globalThis."development" .
I discovered the cause of the error, When vue compile node_modules/graphql/jsutils/instanceOf.mjs,the globalThis.process.env.NODE_ENV will be converted to globalThis."development" .
I also ran into this problem and it is currently being discussed in a thread on the graphql-js repository. You can find the ongoing discussion here: graphql/graphql-js#3978.
There I found a workaround that worked for me. By changing the check from:
Describe the bug
I add Apollo client in main.ts, like this:
Then I run my vue project. The following error occurs
Versions
vue:3.2.25
vue-apollo: I don't konw
@apollo/client:3.8.7
My package.json
{
"name": "client",
"private": true,
"version": "0.0.0",
"scripts": {
"dev": "vite --config vite.config.ts",
"build": "vue-tsc --noEmit && vite --config vite.config.ts build",
"preview": "vite preview"
},
"dependencies": {
"@apollo/client": "^3.8.7",
"@element-plus/icons-vue": "^2.0.10",
"@neysf/qiyu-web-sdk": "^1.1.1",
"@vant/touch-emulator": "^1.4.0",
"@vue/apollo-composable": "^4.0.0-beta.11",
"@vue/apollo-option": "^4.0.0-beta.9",
"axios": "^0.27.2",
"dayjs": "^1.11.7",
"element-plus": "^2.2.32",
"graphql": "^16.8.1",
"graphql-tag": "^2.12.6",
"string-similarity-js": "^2.1.4",
"ts-md5": "^1.3.1",
"vant": "^4.0.10",
"vue": "^3.2.25",
"vue-router": "^4.0.15",
"vuex": "^4.0.2"
},
"devDependencies": {
"@vitejs/plugin-vue": "^2.3.3",
"sass": "^1.52.1",
"sass-loader": "^13.0.0",
"typescript": "^4.5.4",
"vite": "^2.9.9",
"vue-tsc": "^0.34.7"
}
}
The text was updated successfully, but these errors were encountered: