-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
webpacker 3.2.1 hardcodes uglifyOptions: { ecma: 8 } which ignores Babel target options and breaks IE11 compatibility #1235
Comments
You can see the uglify behavior on this online example. Set the input to output: {
ascii_only : true,
ecma : 5, output: {
ascii_only : true,
ecma : 8, |
We are experiencing the same issue, and just fixed it by changing our const environment = require('./environment')
environment.plugins.get("UglifyJs").options.uglifyOptions.ecma = 5
module.exports = environment.toWebpackConfig() |
Will push an option for this in environment during the weekend. In meantime, please use the solution suggested by @danielma |
I just spent a looong time googling for a solution to this. I'm going to add what I was searching for as a comment here to hopefully save other peoples time. The IE11 error I was getting was: The suggested solution here worked for me! |
@clarketus Very good idea! @gauravtiwari When will this be fixed? |
I am aiming to provide an option for this in Webpacker 4.0 but for now the solution suggested above is simple enough to use if you need to support ES5. Thank you. |
+1 to a config option. I think there are still a decent number of teams that need ES5 to support IE11. Having a first class option to change this config will be helpful. |
The solution by @danielma works for us, thank you. This took a really long time to find out 😢 We thought there was a mistake with our Babel configuration. Since Webpacker aims to provide a preconfigured pipeline that includes both Babel and UglifyJS by default, maybe the default config could target the same browsers in all processing steps? Webpacker's default |
Just bumped into this problem. The following code in our vendor pack was using ES2015 syntax: var r=e[i]={i,l:!1,exports:{}} and was throwing this error in IE11:
After @danielma 's fix, the code looked like proper ES5:
I agree with @triskweline |
If you updated to Webpacker 4 (Webpack 4) and are using the default config, the workaround is to add this line to your environment.config.optimization.minimizer[0].options.uglifyOptions.ecma = undefined // the default, or 5 if you want it explicitely |
This is quite a big issue IMHO and took hours to track down. @gauravtiwari possible to get a fix in for this soon? |
Thank you, so glad I found this issue. Just to make this a bit more googleable, my problem was with DraftJS and IE11 telling me
with this statement
|
I have same problem. setting ecma 5 didn't fix the issue
|
4 hours later and only after a desperate |
@renatodeleao This is fixed on the master branch will make a release later in the week. |
using
in my application.js any ideas? )= rails 5.2 my webpacker.yml is pretty defaulty
|
You can use this as a workaround in your if (environment.plugins.getIndex('UglifyJs') !== -1) {
const plugin = environment.plugins.get('UglifyJs');
plugin.options.uglifyOptions.ecma = 5;
} |
thx! now it's working. but i'm a little confused, it's pretty the same thing like the snippet from @danielma above. but just in the environment.js ... very strange that this makes a difference. but anyway! HUGE THANKS! |
It does look like #1235 (comment) (which i didn't see) is essentially the same. Well, glad it worked. :) |
@decafdennis and everybody, thank you so much. tried for too long to figure that out |
|
@R-obert Have you updated both gem and npm package to 3.5.5? https://github.com/rails/webpacker/blob/3-x-stable/package/environments/production.js#L16 |
@gauravtiwari i updated the Gemfile, but not package.json. |
Yep, |
thanks! will try and post back. |
it works! i updated the Gemfile and npm package, then all good. thank you @gauravtiwari |
Great, thanks for reporting back 👍 Closing this issue... |
@1st8 How did you fix this? I'm having the same issue. |
@paulupendo probably with the solution above: #1235 (comment) I can check for sure on monday if it doesn't work. |
Just upgraded from webpacker v3 to v4. I had been using @danielma's solution :
But that now throws an error in v4
but that gives me an error: Any ideas how to fix for webpacker v4? |
I think it should work out of the box for v4. It now uses TerserPlugin, and the corresponding configuration settings are here: webpacker/package/environments/production.js Lines 48 to 52 in 1e9e2d0
|
This was the result of our investigation as well. However, the workaround should not have been needed since 3.5.5 anyway. |
Dumping out the Webpack config in production mode, I have this piece of configuration:
This seems to be from a5e76b8 and thus introduced in 3.2.1.
This affects us because we are using the
remarkable
package, which contains some JS like{Afr:"𝔄",}
, which Babel properly converts to{Afr:"\uD835\uDD04",}
, but then Uglify shortens back to{Afr:"\u{1d504}",}
. This latter syntax isn't supported by IE11, causing issues in production, specifically the error "Expected hexadecimal digit".Related to #1211
The text was updated successfully, but these errors were encountered: