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

arrow functions in webpackBootstrap with browserslist: "IE >= 11" #11753

Closed
micopiira opened this issue Oct 20, 2020 · 10 comments · Fixed by #11754
Closed

arrow functions in webpackBootstrap with browserslist: "IE >= 11" #11753

micopiira opened this issue Oct 20, 2020 · 10 comments · Fixed by #11754

Comments

@micopiira
Copy link

Bug report

What is the current behavior?

With browserslist: "IE >= 11" in my package.json there are arrow functions in generated webpackBootstrap code. It works correctly if I use IE >= 10 in my package.json.

If the current behavior is a bug, please provide the steps to reproduce.

  1. Add "browserslist": "IE >= 11" to package.json
  2. npx webpack

What is the expected behavior?

I would expect the generated code to not have arrow functions for IE >= 11 since IE11 does not support arrow functions.

Other relevant information:
webpack version: 5.1.3
Node.js version: v14.6.0
Operating System: Ubuntu 20.04 LTS (WSL2)
Additional tools:

sokra added a commit that referenced this issue Oct 20, 2020
jumpinjackie added a commit to jumpinjackie/mapguide-react-layout that referenced this issue Oct 20, 2020
@alexander-akait
Copy link
Member

Fix #11754

@anton6
Copy link

anton6 commented Oct 21, 2020

When is this fix going to be published? Is it going to be part of 5.1.4?

@sethomas
Copy link

@evilebottnawi can we re-open this? I am running into the same problem on webpack@5.5.0, if I change browserslist to not ie < 10, it works, but if it's at not ie < 11 I still get arrow functions in my bundle.

@alexander-akait
Copy link
Member

alexander-akait commented Nov 18, 2020

@sethomas double check your webpack version, I can't reopen issue without reproducible steps, sorry

@sethomas
Copy link

@evilebottnawi Odd, I'll chalk it up to me having to deal with IE 11 that threw me off, all is well, sorry for wrong information and thanks for the response.

@amok
Copy link

amok commented Nov 24, 2020

@sethomas setting target: 'web' to target: ['web', 'es5'] helped me

@Eschon
Copy link

Eschon commented Feb 26, 2021

I'm still running into this problem, but only with our production build in a docker image. My local development build works fine.
I'm not sure how to properly reproduce it.

My webpack version is 5.21.2
The docker image is node:14.15-alpine with very little added and the exact node version is 14.15.4
I have a .browserslistrc file with "defaults"

@Eschon
Copy link

Eschon commented Feb 26, 2021

Also happens with the latest webpack version (5.24.2) but at least the workaround suggested by @amok fixes it for me

@MoonE
Copy link

MoonE commented Apr 7, 2021

With OpenLayers there were also arrow functions in the generated code. webpack version 5.30.0
The affected jobs are build-legacy and build-examples, see: https://github.com/openlayers/openlayers/blob/9d773c8f19a157f98391e985f2146747bc4da77e/package.json#L20-L24
The affected output file for build-legacy is build/legacy/ol.js
For build-examples it is build/examples/common.js

Using @amok's suggestion fixed the transpilation of arrow functions.
The change that fixes it is in https://github.com/openlayers/openlayers/pull/12181/files

Hope this information will help you to reproduce, @alexander-akait.

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

Successfully merging a pull request may close this issue.

8 participants