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

fix: use correct temp dir #47

Merged
merged 1 commit into from
May 12, 2023
Merged

fix: use correct temp dir #47

merged 1 commit into from
May 12, 2023

Conversation

bobbyg603
Copy link
Member

@bobbyg603 bobbyg603 commented May 11, 2023

When we package up our node app, the way you find the current working directory is different:

value with node packaged comments
__filename /project/app.js /snapshot/project/app.js
__dirname /project /snapshot/project
process.cwd() /project /deploy suppose the app is called ...
process.execPath /usr/bin/nodejs /deploy/app-x64 app-x64 and run in /deploy
process.argv[0] /usr/bin/nodejs /deploy/app-x64
process.argv[1] /project/app.js /snapshot/project/app.js
process.pkg.entrypoint undefined /snapshot/project/app.js
process.pkg.defaultEntrypoint undefined /snapshot/project/app.js
require.main.filename /project/app.js /snapshot/project/app.js

source: https://github.com/vercel/pkg#snapshot-filesystem

that change just prefers process.cwd() over __dirname which i found out by referencing that chart in pkg

@bobbyg603 bobbyg603 merged commit 792c9e0 into main May 12, 2023
@bobbyg603 bobbyg603 deleted the fix-snapshot-dir-error branch May 12, 2023 12:40
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.

1 participant