-
-
Notifications
You must be signed in to change notification settings - Fork 635
IE 11 fails with SCRIPT1003: Expected ':' #1091
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
Comments
I attempted to reproduce the error locally in the spec/dummy app, but could not. Taking a look at the code that gets generated, the function in question does correctly have the keys
However, once minified on the server, we get the following:
|
Ie cannot handle the object shorthand notation. |
Yes. But I am not clear on why compressing/uglifying the JS is converting key/value pairs, which appear in the uncompressed versions (on the server in the node_modules folder) and when running locally, to the short-hand. |
It turns out that this was caused by a change with webpacker and UglifyJS. Previously, UglifyJS was configured to return ECMA 5 level code, but that was changed to 8 (rails/webpacker#1235). IE 11 requires 5. To fix this, we added the following statement to our config/webpacker/production.js file:
So this is not an issue with ReactOnRails...closing |
When loading React components into a rails app using ReactOnRails, the components fail to load on IE 11 and the following error is displayed:
SCRIPT1003: Expected ':'
The error points to the comma after the 'e' character in the compiled code:
I have tracked this down to the serverRenderReactComponent that has the following code:
According to this article: https://stackoverflow.com/questions/46776046/script1003-expected-in-ie-11-only, IE11 requires the keys to be included when instatiating an object, as follows:
This is how
handleError
is called in the react_on_rails_helper.rb file.It also only seems to be an error once the code is minified, as I was not able to reproduce the error locally running in development.
I have forked the repo and attempted to make this change, however, i can't seem to get my code to pick up that change. It continues to reference the serverRenderReactComponent as if I had made no changes, though I have verified that my application is using our forked version of the gem, and that the gem on the server is our version, and contains the above change to include the keys in the object definition.
Your thoughts are greatly appreciated.
The text was updated successfully, but these errors were encountered: