sindresorhus/opn


Do you want to work on this issue?
You can request for a bounty in order to promote it!
v9 fails within VSCode extension as import.meta.url is null #324
tomqwpl posted onGitHub
I'm by no means a node expert, so I don't know whether import.meta.url being null is unexpected or not. Trying to use this within a VSCode extension. The "import" of open fails, with an error on the line:
const __dirname = path.dirname(fileURLToPath(import.meta.url));
Error is:
TypeError: The "path" argument must be of type string or an instance of URL. Received undefined
at new NodeError (node:internal/errors:399:5)
at fileURLToPath (node:internal/url:1491:11)
I don't know what is unusual about how vscode is loading modules. Not had any issues previously.
The v8.4.2 works in this regard. However, with that version you don't appear to be able to open "file:" urls without explicitly specifying that it should use a browser (using app: { name: apps.chrome}
for example). However, that version doesn't have the ability to use the default browser.