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

IE11 is throwing errors #1226

Closed
karolisgrinkevicius-home24 opened this issue Apr 10, 2019 · 24 comments
Closed

IE11 is throwing errors #1226

karolisgrinkevicius-home24 opened this issue Apr 10, 2019 · 24 comments

Comments

@karolisgrinkevicius-home24

Description

IE11 is throwing error regarding usage of Object.assign without it being polyfilled.

Expected behavior

IE11 doesn't throw any error in console.

Actual behavior

IE11 throws any error in console.

Environment

React Hot Loader version: 4.8.3

Run these commands in the project folder and fill in their results:

  • npm@6.9.0
  • node@11.12.0
  • MAC OS X 10.14.4
  • IE11 on Windows 8.1

This should be fairly easy to reproduce for everyone. I used VirtualBox.

@theKashey
Copy link
Collaborator

Fair issue. As long as there were just one valid reason to use Object.assign - easy to fix.

@karolisgrinkevicius-home24
Copy link
Author

@theKashey thanks a lot for your quick response and commit related to this issue. Do you have a clue when this is going to be released in the registry?

@theKashey
Copy link
Collaborator

Only tomorrow, sorry

@karolisgrinkevicius-home24
Copy link
Author

For me c5af009 didn't fix the issue in IE11. Since we're supposed to include import { hot } from 'react-hot-loader/root'; there still Object.assign is present. https://github.com/gaearon/react-hot-loader/blob/v4.8.4/root.js#L17

@theKashey Could you please take another look into this? Thanks.

@theKashey
Copy link
Collaborator

Oh, that file dropped from my sight. I was analyzing only /src paired example using the old hot API.

@theKashey theKashey reopened this Apr 15, 2019
@theKashey
Copy link
Collaborator

Now it's shall be done :)

@karolisgrinkevicius-home24
Copy link
Author

After upgrading react-hot-loader to the latest version (4.8.5) I'm getting a syntax error:
Screenshot 2019-05-16 at 09 48 06
I tried importing without root as an error states as follows:

import { hot } from 'react-hot-loader';

But in this case I get yet another error complaining about hot has not been found in the module itself.
Screenshot 2019-05-16 at 09 52 06

@theKashey
Copy link
Collaborator

At it was working before?
Could you please debug this code, changes were around

  • the first check - it was module.parents[0], which is the same (ie parent existed).
  • the module.hot check. Without it(module.hot.accept) nothing would work, it should exists

@theKashey
Copy link
Collaborator

@karolisgrinkevicius-home24 - I really need an answer! Did I shipped broken version, or it's not so bad?!

@karolisgrinkevicius-home24
Copy link
Author

@theKashey actually the error is different than it was before using IE11. On Chrome it's working well just like before.

Could you please debug this code, changes were around

I honestly didn't get what you want me to debug. Could you please clarify?

@theKashey
Copy link
Collaborator

So it’s working for Chrome, but generate this change errors only for IE11?
Is it the same build?

@karolisgrinkevicius-home24
Copy link
Author

Yes. The error is thrown only on IE11. I was using a new build which is https://www.npmjs.com/package/react-hot-loader/v/4.8.5. The error on IE11 is caught in react-hot-loader/root.js:6, seems to be an issue that module doesn't have parents for some reasons on IE11.

@tzimmermann
Copy link

After some digging, I found that the new IE11 SyntaxError is caused by a trailing commas in the Error constructor argument list.

This fails in IE11

throw new Error(
      'React-Hot-Loader: `react-hot-loader/root` is not supported on your system. ' +
        'Please use `import {hot} from "react-hot-loader"` instead',
    );

but this works:

throw new Error(
      'React-Hot-Loader: `react-hot-loader/root` is not supported on your system. ' +
        'Please use `import {hot} from "react-hot-loader"` instead'
    );

When I fix it locally, though, I get another error that Promise is undefined which originates here https://github.com/gaearon/react-hot-loader/blob/master/src/global/generation.js#L47

@tzimmermann
Copy link

Yes. The error is thrown only on IE11. I was using a new build which is https://www.npmjs.com/package/react-hot-loader/v/4.8.5. The error on IE11 is caught in react-hot-loader/root.js:6, seems to be an issue that module doesn't have parents for some reasons on IE11.

@karolisgrinkevicius-home24 Note that the SyntaxError (at least the one I am getting) has nothing to do with runtime problems like a missing module.parents.
IE chokes on some syntax that it cannot parse, even before evaluating the JS code block.

@theKashey
Copy link
Collaborator

Trailing commas are mine bad, sorry.
But you have to add polyfills by your own.

@karolisgrinkevicius-home24
Copy link
Author

Polyfills are not a problem at all. @tzimmermann thanks for digging into the issue. @theKashey could you please fix that SyntaxError so that IE11 engine is able to parse it properly?

@theKashey theKashey reopened this May 17, 2019
@theKashey
Copy link
Collaborator

v4.8.6 would fix it

@maulikdesai21
Copy link

Is this fixed? I am still getting Object.assign in 4.12.11 and 4.8.6 gives me Promise in undefined :(

@theKashey
Copy link
Collaborator

So it's broken again then. Some polyfills, like Promises or Object.assign, are commonly expected to be present :(

@theo-mesnil
Copy link

I have the same issue :(

@theKashey
Copy link
Collaborator

Just tested - the only polyfill RHL is requiring - Promise (import 'core-js/modules/es6.promise';), which going to be used in any case.

@suhanw
Copy link

suhanw commented Nov 11, 2020

I'm on 4.13.0, and it appears Promise is still undefined, it's throwing the error here:

Promise.resolve(incrementHot()).then(() => setTimeout(decrementHot, 0));

@StefanoVuerich
Copy link

Having the same issue @suhanw was showing.

Any news on this? Cannot run o IE11.

@moonjoungyoung
Copy link

Any news on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants