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 was 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.
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
thisbeing overwritten toundefinedbut in actuality, the cause of the failure is the naming of one of the exports on therequest-base.jsmodule. 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 localclearTimeoutfunction which tries to call the globalclearTimeoutends 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): forwardemail/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