nuxt-modules / apollo

Nuxt.js module to use Vue-Apollo. The Apollo integration for GraphQL.
https://apollo.nuxtjs.org
MIT License
954 stars 198 forks source link

Stop working in IE11 #372

Open manakuro opened 3 years ago

manakuro commented 3 years ago

Version

v4.0.0-rc.5

Reproduction link

Nothing

Steps to reproduce

yarn dev

visit http://localhost:3000/ in IE11

What is expected ?

Working application without error in IE11

What is actually happening?

The error is logged in the console, in the nuxt/vendors/app.js file, only in IE11:

スクリーンショット 2020-12-13 13.28.35.png

It seems that the src folder is used for vue-cli-plugin-apollo/graphql-client instead of dist which is transpiled.

It occurred after this commit. https://github.com/nuxt-community/apollo-module/commit/05fccfe6d6bbfe583bd720029276d81c615047b0#diff-5acbea5e90939d8ded320a17e74b9fe35c66ef8543384b023054c69570cf81f7R4

Transpiled code is here

/***/
"./node_modules/vue-cli-plugin-apollo/graphql-client/src/index.js":
/*!************************************************************************!*\
 !*** ./node_modules/vue-cli-plugin-apollo/graphql-client/src/index.js ***!
 \************************************************************************/
/*! exports provided: createApolloClient, restartWebsockets */
/***/
(function(module, __webpack_exports__, __webpack_require__) {

  "use strict";
  eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"createApolloClient\", function() { return createApolloClient; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"restartWebsockets\", function() { return restartWebsockets; });\n/* harmony import */ var apollo_client__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! apollo-client */ \"./node_modules/apollo-client/bundle.esm.js\");\n/* harmony import */ var apollo_link__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! apollo-link */ \"./node_modules/vue-cli-plugin-apollo/node_modules/apollo-link/lib/bundle.esm.js\");\n/* harmony import */ var apollo_upload_client__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! apollo-upload-client */ \"./node_modules/apollo-upload-client/lib/index.js\");\n/* harmony import */ var apollo_upload_client__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(apollo_upload_client__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var apollo_cache_inmemory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! apollo-cache-inmemory */ \"./node_modules/apollo-cache-inmemory/lib/bundle.esm.js\");\n/* harmony import */ var subscriptions_transport_ws__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! subscriptions-transport-ws */ \"./node_modules/subscriptions-transport-ws/dist/client.js\");\n/* harmony import */ var subscriptions_transport_ws__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(subscriptions_transport_ws__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var subscriptions_transport_ws_dist_message_types__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! subscriptions-transport-ws/dist/message-types */ \"./node_modules/subscriptions-transport-ws/dist/message-types.js\");\n/* harmony import */ var subscriptions_transport_ws_dist_message_types__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(subscriptions_transport_ws_dist_message_types__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var apollo_link_ws__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! apollo-link-ws */ \"./node_modules/apollo-link-ws/lib/bundle.esm.js\");\n/* harmony import */ var apollo_utilities__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! apollo-utilities */ \"./node_modules/vue-cli-plugin-apollo/node_modules/apollo-utilities/lib/bundle.esm.js\");\n/* harmony import */ var apollo_link_persisted_queries__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! apollo-link-persisted-queries */ \"./node_modules/apollo-link-persisted-queries/lib/index.js\");\n/* harmony import */ var apollo_link_context__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! apollo-link-context */ \"./node_modules/apollo-link-context/lib/bundle.esm.js\");\n/* harmony import */ var apollo_link_state__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! apollo-link-state */ \"./node_modules/apollo-link-state/lib/index.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n// Create the apollo client\nfunction createApolloClient ({\n  // Client ID if using multiple Clients\n  clientId = 'defaultClient',\n  // URL to the HTTP API\n  httpEndpoint,\n  // Url to the Websocket API\n  wsEndpoint = null,\n  // Token used in localstorage\n  tokenName = 'apollo-token',\n  // Enable this if you use Query persisting with Apollo Engine\n  persisting = false,\n  // Is currently Server-Side Rendering or not\n  ssr = false,\n  // Only use Websocket for all requests (including queries and mutations)\n  websocketsOnly = false,\n  // Custom starting link.\n  // If you want to replace the default HttpLink, set `defaultHttpLink` to false\n  link = null,\n  // Custom pre-auth links\n  // Useful if you want, for example, to set a custom middleware for refreshing an access token.\n  preAuthLinks = [],\n  // If true, add the default HttpLink.\n  // Disable it if you want to replace it with a terminating link using `link` option.\n  defaultHttpLink = true,\n  // Options for the default HttpLink\n  httpLinkOptions = {},\n  // Custom Apollo cache implementation (default is apollo-cache-inmemory)\n  cache = null,\n  // Options for the default cache\n  inMemoryCacheOptions = {},\n  // Additional Apollo client options\n  apollo = {},\n  // apollo-link-state options\n  clientState = null,\n  // Function returning Authorization header token\n  getAuth = defaultGetAuth,\n  // Local Schema\n  typeDefs = undefined,\n  // Local Resolvers\n  resolvers = undefined,\n  // Hook called when you should write local state in the cache\n  onCacheInit = undefined,\n}) {\n  let wsClient, authLink, stateLink\n  const disableHttp = websocketsOnly && !ssr && wsEndpoint\n\n  // Apollo cache\n  if (!cache) {\n    cache = new apollo_cache_inmemory__WEBPACK_IMPORTED_MODULE_3__[\"InMemoryCache\"](inMemoryCacheOptions)\n  }\n\n  if (!disableHttp) {\n    const httpLink = Object(apollo_upload_client__WEBPACK_IMPORTED_MODULE_2__[\"createUploadLink\"])({\n      uri: httpEndpoint,\n      ...httpLinkOptions,\n    })\n\n    if (!link) {\n      link = httpLink\n    } else if (defaultHttpLink) {\n      link = Object(apollo_link__WEBPACK_IMPORTED_MODULE_1__[\"from\"])([link, httpLink])\n    }\n\n    // HTTP Auth header injection\n    authLink = Object(apollo_link_context__WEBPACK_IMPORTED_MODULE_9__[\"setContext\"])(async (_, { headers }) => {\n      const Authorization = await getAuth(tokenName)\n      const authorizationHeader = Authorization ? { Authorization } : {}\n      return {\n        headers: {\n          ...headers,\n          ...authorizationHeader,\n        },\n      }\n    })\n\n    // Concat all the http link parts\n    link = authLink.concat(link)\n\n    if (preAuthLinks.length) {\n      link = Object(apollo_link__WEBPACK_IMPORTED_MODULE_1__[\"from\"])(preAuthLinks).concat(authLink)\n    }\n  }\n\n  // On the server, we don't want WebSockets and Upload links\n  if (!ssr) {\n    // If on the client, recover the injected state\n    if (typeof window !== 'undefined') {\n      // eslint-disable-next-line no-underscore-dangle\n      const state = window.__APOLLO_STATE__\n      if (state && state[clientId]) {\n        // Restore state\n        cache.restore(state[clientId])\n      }\n    }\n\n    if (!disableHttp) {\n      let persistingOpts = {}\n      if (typeof persisting === 'object' && persisting != null) {\n        persistingOpts = persisting\n        persisting = true\n      }\n      if (persisting === true) {\n        link = Object(apollo_link_persisted_queries__WEBPACK_IMPORTED_MODULE_8__[\"createPersistedQueryLink\"])(persistingOpts).concat(link)\n      }\n    }\n\n    // Web socket\n    if (wsEndpoint) {\n      wsClient = new subscriptions_transport_ws__WEBPACK_IMPORTED_MODULE_4__[\"SubscriptionClient\"](wsEndpoint, {\n        reconnect: true,\n        connectionParams: () => {\n          const Authorization = getAuth(tokenName)\n          return Authorization ? { Authorization, headers: { Authorization } } : {}\n        },\n      })\n\n      // Create the subscription websocket link\n      const wsLink = new apollo_link_ws__WEBPACK_IMPORTED_MODULE_6__[\"WebSocketLink\"](wsClient)\n\n      if (disableHttp) {\n        link = link ? link.concat(wsLink) : wsLink\n      } else {\n        link = Object(apollo_link__WEBPACK_IMPORTED_MODULE_1__[\"split\"])(\n          // split based on operation type\n          ({ query }) => {\n            const { kind, operation } = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_7__[\"getMainDefinition\"])(query)\n            return kind === 'OperationDefinition' &&\n              operation === 'subscription'\n          },\n          wsLink,\n          link,\n        )\n      }\n    }\n  }\n\n  if (clientState) {\n    console.warn('clientState is deprecated, see https://vue-cli-plugin-apollo.netlify.com/guide/client-state.html')\n    stateLink = Object(apollo_link_state__WEBPACK_IMPORTED_MODULE_10__[\"withClientState\"])({\n      cache,\n      ...clientState,\n    })\n    link = Object(apollo_link__WEBPACK_IMPORTED_MODULE_1__[\"from\"])([stateLink, link])\n  }\n\n  const apolloClient = new apollo_client__WEBPACK_IMPORTED_MODULE_0__[\"ApolloClient\"]({\n    link,\n    cache,\n    // Additional options\n    ...(ssr ? {\n      // Set this on the server to optimize queries when SSR\n      ssrMode: true,\n    } : {\n      // This will temporary disable query force-fetching\n      ssrForceFetchDelay: 100,\n      // Apollo devtools\n      connectToDevTools: \"development\" !== 'production',\n    }),\n    typeDefs,\n    resolvers,\n    ...apollo,\n  })\n\n  // Re-write the client state defaults on cache reset\n  if (stateLink) {\n    apolloClient.onResetStore(stateLink.writeDefaults)\n  }\n\n  if (onCacheInit) {\n    onCacheInit(cache)\n    apolloClient.onResetStore(() => onCacheInit(cache))\n  }\n\n  return {\n    apolloClient,\n    wsClient,\n    stateLink,\n  }\n}\n\nfunction restartWebsockets (wsClient) {\n  // Copy current operations\n  const operations = Object.assign({}, wsClient.operations)\n\n  // Close connection\n  wsClient.close(true)\n\n  // Open a new one\n  wsClient.connect()\n\n  // Push all current operations to the new connection\n  Object.keys(operations).forEach(id => {\n    wsClient.sendMessage(\n      id,\n      subscriptions_transport_ws_dist_message_types__WEBPACK_IMPORTED_MODULE_5___default.a.GQL_START,\n      operations[id].options,\n    )\n  })\n}\n\nfunction defaultGetAuth (tokenName) {\n  if (typeof window !== 'undefined') {\n    // get the authentication token from local storage if it exists\n    const token = window.localStorage.getItem(tokenName)\n    // return the headers to the context so httpLink can read them\n    return token ? `Bearer ${token}` : ''\n  }\n}\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset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ZGVmaW5lZCcpIHtcbiAgICAvLyBnZXQgdGhlIGF1dGhlbnRpY2F0aW9uIHRva2VuIGZyb20gbG9jYWwgc3RvcmFnZSBpZiBpdCBleGlzdHNcbiAgICBjb25zdCB0b2tlbiA9IHdpbmRvdy5sb2NhbFN0b3JhZ2UuZ2V0SXRlbSh0b2tlbk5hbWUpXG4gICAgLy8gcmV0dXJuIHRoZSBoZWFkZXJzIHRvIHRoZSBjb250ZXh0IHNvIGh0dHBMaW5rIGNhbiByZWFkIHRoZW1cbiAgICByZXR1cm4gdG9rZW4gPyBgQmVhcmVyICR7dG9rZW59YCA6ICcnXG4gIH1cbn1cbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./node_modules/vue-cli-plugin-apollo/graphql-client/src/index.js\n");

  /***/
}),

And then, IE11 crushes down because const is still used there.

This bug report is available on Nuxt community (#c350)
nezzard commented 3 years ago

Have the same problem, on ie and edge

manakuro commented 3 years ago

The workaround is to include vue-cli-plugin-apollo/graphql-client/src in nuxt.config.js to transpile, like so.

transpile: ['vue-cli-plugin-apollo/graphql-client/src']