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

Replace calls to eval('require') with require #213

Open
michaelhays opened this issue May 30, 2024 · 1 comment
Open

Replace calls to eval('require') with require #213

michaelhays opened this issue May 30, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@michaelhays
Copy link

Description of the Issue

I've had issues running this library on Vercel serverless functions for a few months now, documented in #54 and #96.

I just upgraded to box-typescript-sdk-gen@1.0.0 and am still getting the same issue, with a third library this time:

Cannot find module 'proxy-agent'

However, this time I tried patching the library, and replacing all calls to eval('require') with simply require (such as on this line) and this seems to have fixed all of my issues.

Are you able to do this across this codebase? Curious, what was the reason for using eval('require') in the first place?

Versions Used

Typescript SDK: v1.0.0
Platform: Node.js
Node.js (if applicable): 20.13.1

@congminh1254
Copy link
Member

Hi @michaelhays

The reason why we are using this eval('require') instead of require is to make it compatible with some frontend frameworks, while these frameworks are not using the libraries above but still trying to resolve it.

We will soon change it back to require but we need to figure out whether the frontend framework should use polyfills to override the missing library by their side or if we will have a custom version of the TS SDK for the browser only.

We are sorry for any inconvenience.

Best,
Minh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants