Skip to content

Conversation

bbsimonbb
Copy link

Fixes the issue described here with the fix suggested in the answer.

Fixes the issue described [here](https://stackoverflow.com/questions/72407165/nodejs-error-using-import-with-iisnode)
with the fix suggested in the answer.
@ZachHaber
Copy link

It actually seems to work better if you use

import(require('url').pathToFileUrl(process.argv[1]));

From my experimentations with iisnode, if you use the child_process approach, then the logging seems to fail.

This one uses at least node 14 for the dynamic import, but anything less than node 14 likely wouldn't be using ESModules anyway.

@aklietz
Copy link

aklietz commented Jan 10, 2025

import(require('url').pathToFileUrl(process.argv[1]));

URL is all caps:

import(require('url').pathToFileURL(process.argv[1]));

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.

3 participants