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: support Single Executable Applications #350

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sebamarynissen
Copy link

I'm using this module with Node's new Single Executable Application functionality. Currently this requires you to bundle your application into a single JavaScript file, which I'm doing with esbuild. However, when importing the module, it chokes over

const __dirname = path.dirname(fileURLToPath(import.meta.url));

because after bundling with esbuild, import.meta.url is undefined.

This PR fixes that by falling back to process.execPath in case import.meta.url is undefined. This also means that if someone wants to use the bundled xdg binary, they can distribute it alongside the sea binary and it should work.

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