-
Notifications
You must be signed in to change notification settings - Fork 6
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
Comments
Hi @michaelhays The reason why we are using this We will soon change it back to We are sorry for any inconvenience. Best, |
For anyone else dealing with this issue with Next.js on Vercel, there is an config option Either way, thanks for maintaining this library, and hopefully this can be helpful to anyone else having this issue :) |
Success! Thanks so much for the tip @jasonappah. You need to include the full nested set of dependencies for /** @type {import('next').NextConfig} */
const config = {
experimental: {
outputFileTracingIncludes: {
'/api/**/*': [
'node_modules/@tootallnate/quickjs-emscripten/**/*',
'node_modules/agent-base/**/*',
'node_modules/ast-types/**/*',
'node_modules/asynckit/**/*',
'node_modules/basic-ftp/**/*',
'node_modules/combined-stream/**/*',
'node_modules/data-uri-to-buffer/**/*',
'node_modules/debug/**/*',
'node_modules/degenerator/**/*',
'node_modules/delayed-stream/**/*',
'node_modules/escodegen/**/*',
'node_modules/esprima/**/*',
'node_modules/estraverse/**/*',
'node_modules/esutils/**/*',
'node_modules/form-data/**/*',
'node_modules/fs-extra/**/*',
'node_modules/get-uri/**/*',
'node_modules/graceful-fs/**/*',
'node_modules/http-proxy-agent/**/*',
'node_modules/https-proxy-agent/**/*',
'node_modules/ip-address/**/*',
'node_modules/jsbn/**/*',
'node_modules/jsonfile/**/*',
'node_modules/lru-cache/**/*',
'node_modules/mime-db/**/*',
'node_modules/mime-types/**/*',
'node_modules/ms/**/*',
'node_modules/netmask/**/*',
'node_modules/pac-proxy-agent/**/*',
'node_modules/pac-resolver/**/*',
'node_modules/proxy-agent/**/*',
'node_modules/proxy-from-env/**/*',
'node_modules/smart-buffer/**/*',
'node_modules/socks/**/*',
'node_modules/socks-proxy-agent/**/*',
'node_modules/sprintf-js/**/*',
'node_modules/tslib/**/*',
'node_modules/universalify/**/*',
],
},
},
}
export default config Note that for Next.js 14, If you're curious, this is the dependency tree I mapped out:
|
Just wanted to add some more negative downstream effects of using |
For anyone struggling with this issue - it's a little hacky, but if you're adventurous you can manually patch the source before building: Linux cd ./node_modules/box-typescript-sdk/gen/
find . -type f -exec sed -i "s/eval('require')/require/g" {} + macOS cd ./node_modules/box-typescript-sdk/gen/
find . -type f -exec sed -i '' "s/eval('require')/require/g" {} + |
This issue has been automatically marked as stale because it has not been updated in the last 30 days. It will be closed if no further activity occurs within the next 7 days. Feel free to reach out or mention Box SDK team member for further help and resources if they are needed. |
!notstale |
Has anyone had any luck resolving this issue when using |
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:However, this time I tried patching the library, and replacing all calls to
eval('require')
with simplyrequire
(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
The text was updated successfully, but these errors were encountered: