Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

with-apollo example errors in IE11 #5426

Closed
mintyfloss opened this issue Oct 11, 2018 · 3 comments
Closed

with-apollo example errors in IE11 #5426

mintyfloss opened this issue Oct 11, 2018 · 3 comments
Labels
good first issue Easy to fix issues, good for newcomers

Comments

@mintyfloss
Copy link

mintyfloss commented Oct 11, 2018

Examples bug report

Example name

with-apollo

Describe the bug

Loading the with-apollo example in IE11 has the errors below:

SCRIPT438: Object doesn't support property or method 'assign'
File: _app.js, Line: 39168, Column: 17

I added a polyfill for Object.assign, and I get another error:

SCRIPT5007: Unable to get property 'get' of undefined or null reference

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Load with-apollo in IE11

  2. Should see the error about Object.assign

  3. Add client/polyfills.js file

    // client/polyfills.js
    import "core-js/fn/object/assign";
  4. Add next.config.js file

    // next.config.js
    const withTM = require("next-plugin-transpile-modules");
    
    module.exports = {
      transpileModules: ["react-apollo"],
      webpack: config => {
        const originalEntry = config.entry;
    
        config.entry = async () => {
          const entries = await originalEntry();
    
          if (
            entries["main.js"] &&
            !entries["main.js"].includes("./client/polyfills.js")
          ) {
            entries["main.js"].unshift("./client/polyfills.js");
          }
    
          return entries;
        };
    
        return config;
      }
    };
  5. Object.assign error is gone but now the browser console displays the error Unable to get property 'get' of undefined or null reference

  6. App is stuck in loading state

screen shot 2018-10-10 at 9 21 50 pm

Expected behavior

with-apollo example should be fully functional and display the fully loaded state with no console errors in IE11.

Screenshots

What I'm seeing after polyfilling:

screen shot 2018-10-10 at 9 25 19 pm

System information

  • OS: macOS
  • Browser: IE11
  • Version of Next.js: 7.0.1

Additional context

I also tried transpiling react-apollo and apollo-boost using next-plugin-transpile-modules but that didn't help.

@barnslig
Copy link

I experience the same bug. As a temporary workaround I installed apollo-cache-inmemory@1.2.10 and manually used in in init-apollo.js like this:

import { ApolloClient, HttpLink } from 'apollo-boost';
import { InMemoryCache } from 'apollo-cache-inmemory';
...

The problem seems to appear from apollo-cache-inmemory@1.3.0 and newer so I guess it would be a good idea to open an issue at their project.

@timneutkens timneutkens added help wanted good first issue Easy to fix issues, good for newcomers labels Oct 17, 2018
@oliviertassinari
Copy link
Contributor

oliviertassinari commented Oct 19, 2018

It's not a Next.js issue: apollographql/apollo-client#4024.

@timneutkens
Copy link
Member

Let's close this then, as it's tracked in apollographql/apollo-client#4024

@lock lock bot locked as resolved and limited conversation to collaborators Oct 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Easy to fix issues, good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants