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

Resolve IE issue that cannot understand arrow function #1465

Closed
wants to merge 1 commit into from
Closed

Resolve IE issue that cannot understand arrow function #1465

wants to merge 1 commit into from

Conversation

jsveron23
Copy link

screenshot 2019-03-05 at 11 31 22 am

  • IE 11 cannot understand arrow function

@shankie-codes
Copy link

@jsveron23 do you have this issue just with getXHR? For me, IE also fails here:

https://github.com/visionmedia/superagent/blob/1724997edc451df62139385266d17438002d918f/lib/agent-base.js#L6

@shankie-codes
Copy link

As a workaround, I've modified my webpack config to exclude superagent from my node_modules exclusions (if that makes sense!) using this webpack/webpack#2031 (comment)

@jsveron23
Copy link
Author

jsveron23 commented Mar 24, 2019

@shankie-san I think, most people ignore transpile JS inside node_modules directory. Because of improving performance. And mostly, node packages already transpiled. So, those solution(you've mentioned) is fine. I found this package not support ES2015~ for IE as native Javascript way anymore. So, I have no idea this PR is ok for them.

@jsveron23 jsveron23 closed this Mar 28, 2019
@niftylettuce
Copy link
Collaborator

I will be publishing a new version soon that is compiled for older browser support (last 2 versions and > 1%).

@shankie-codes
Copy link

👍 @niftylettuce

@shankie-codes
Copy link

@niftylettuce if you think of it, if you could post back here once that's published, that would be great – as other people will come to this issue if they've searched Google for "superagent arrow functions"

@niftylettuce
Copy link
Collaborator

I commented everywhere else here in this GH repo but this issue (my bad!), v5.0.0 was released last night! @shankie-san.


v5.0.0 was just released to NPM and an updated README is now available here on GitHub (see https://github.com/visionmedia/superagent#superagent).

What's new

  • Browser version is now only 19KB (that's 60% in file size savings from v4.x which was 48KB)!
  • Codebase refactored using xo, prettier, remark, and more
  • Browser compatibility linting via eslint-plugin-compat
  • Browserslist integration (current targets are > 1%, last 2 versions, ie 9)

How to install

npm install superagent@latest

Or if you're using yarn:

yarn add superagent@latest

Polyfills

Please see the Required Browser Features section in the README if you plan to support IE 9 and/or IE 10 and use superagent.

@shankie-codes
Copy link

Great thanks for letting me know @niftylettuce

@lorenzos
Copy link
Contributor

lorenzos commented Apr 8, 2019

I still have arrow functions from superagent in my build, I'm using 5.0.2. How's that? I'm using browserify, for some reason it's using source files instead of the ones in dist/...

I'm requiring superagent explicitly from the dist/ files as a workaround:

const superagent = require('./node_modules/superagent/dist/superagent.min.js');

@niftylettuce
Copy link
Collaborator

Please share your complete configuration - the easiest way for us to help you is to create a repository on GitHub that we can clone locally and reproduce this issue.

@lorenzos
Copy link
Contributor

lorenzos commented Apr 8, 2019

@niftylettuce I made a super simple private repo, and grant you access: https://github.com/lorenzos/superagent-demo-1465/invitations. Just clone and run npm install && npm run build, and you will se in build/build.js the superagent source file with all the arrows functions.

@niftylettuce
Copy link
Collaborator

See my comment here: #1470 (comment)

@lorenzos
Copy link
Contributor

lorenzos commented Apr 9, 2019

@niftylettuce Thanks for your many comments explaining the issue and explaining why superagent works differently from other packages. I'll try to configure Babelify so that it transforms superagent files in node_modules, i.e. using { global: true, ignore: /\/node_modules\/(?!superagent\/)/ }. Thanks.

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

Successfully merging this pull request may close these issues.

None yet

4 participants