You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.
I'm trying to bundle Superagent using rollup and it is not working. I had originally thought the issue had to do with this being overwritten to undefined but in actuality, the cause of the failure is the naming of one of the exports on the request-base.js module. That module exports a bunch of functions using exports.[name-of-function] syntax. One of the functions exported is exports.clearTimeout. That function itself calls the global clearTimeout, but this call to the global method gets shadowed upon transformation and during run-time the local clearTimeout function which tries to call the global clearTimeout ends up calling itself instead causing an error.
Sorry for the slow response. I'm unable to run the repro because of this line. Could you update it please so that there's no TypeScript noise in the repro (unless TS is part of the problem)?
BTW, we've released superagent 3 with a workaround for this. I think the problem still exists in rollup, but we've changed our inheritance implementation to dodge it.
Minimal reproduction repo: https://github.com/ntilwalli/rollupSuperagentIssue
I'm trying to bundle Superagent using rollup and it is not working. I had originally thought the issue had to do with
this
being overwritten toundefined
but in actuality, the cause of the failure is the naming of one of the exports on therequest-base.js
module. That module exports a bunch of functions usingexports.[name-of-function]
syntax. One of the functions exported isexports.clearTimeout
. That function itself calls the globalclearTimeout
, but this call to the global method gets shadowed upon transformation and during run-time the localclearTimeout
function which tries to call the globalclearTimeout
ends up calling itself instead causing an error.The offending function is here: https://github.com/visionmedia/superagent/blob/master/lib/request-base.js#L15
A non-ideal workaround does exist and has been posted (but this is arguably more of rollup-plugin-commonjs issue): ladjs/superagent#1076
I'm looking to start a discussion on how to handle this. I'd be willing to submit a PR if given guidance.
cc: @pornel
The text was updated successfully, but these errors were encountered: