ITADN

fix: support Single Executable Applications

#350Pull Requestsebamarynissen 创建于 2024-11-12
S
sebamarynissencommented
I'm using this module with Node's new [Single Executable Application functionality](https://nodejs.org/api/single-executable-applications.html). 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 ```js 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.
合并状态:未合并 关闭于 2025-11-10 3 条评论