exuanbo / module-from-string

Load module from string using require or import.
MIT License
49 stars 2 forks source link

Cannot dynamically import in windows #17

Closed matt-way closed 2 years ago

matt-way commented 2 years ago

When trying to perform a dynamic import inside code imported using this lib, I get this error on windows:

"Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'"

However if I put the required file:/// prefix it still fails because path.resolve() called inside resolveModuleSpecifier strips this away.

exuanbo commented 2 years ago

This should be fixed in new patch version 3.2.1.